How zerodha/gokiteconnect works
Main Components
a. Client Layer:
• Two main sub-components:
• REST Client (from connect.go, http.go)
• WebSocket Client (from ticker/ticker.go)
b. Feature Modules:
• User Management (user.go)
• Orders Management (orders.go)
• Portfolio Management (portfolio.go)
• Market Data (market.go)
• Margins (margins.go)
• Mutual Funds (mutualfunds.go)
c. Models Layer:
• A "Models" container (from models/ directory)
• Model types like Time and Snaps
d. External Systems:
• Kite Connect REST API
• Kite Connect WebSocket API
• Client Applications (users of this SDK)
Connection and Data Flow
• Bidirectional communication between the SDK and Kite Connect servers
Important Elements to Highlight
a. Authentication Flow:
• Login URL generation
• Session token generation
• Access token management
b. Real-time Data Flow:
• WebSocket connection
• Ticker subscription
• Event callbacks
Technical Details
• That it's a Go-based SDK
• Version compatibility (v4)
• HTTP/REST and WebSocket protocols
• Callback interfaces for real-time events
[Client Applications] → [Kite Connect SDK] → [Kite Connect APIs]
[REST Client] [WebSocket Client]
• ↓ ↓
[Feature Modules] [Real-time Events]
• ↓ ↓
[Models Layer] [Error Handling]
[Authentication] [Configuration] [Utilities]