-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathmarket.go
30 lines (26 loc) · 889 Bytes
/
market.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package smartapigo
import "net/http"
// LTPResponse represents LTP API Response.
type LTPResponse struct {
Exchange string `json:"exchange"`
TradingSymbol string `json:"tradingsymbol"`
SymbolToken string `json:"symboltoken"`
Open float32 `json:"open"`
High float32 `json:"high"`
Low float32 `json:"low"`
Close float32 `json:"close"`
Ltp float32 `json:"ltp"`
}
// LTPParams represents parameters for getting LTP.
type LTPParams struct {
Exchange string `json:"exchange"`
TradingSymbol string `json:"tradingsymbol"`
SymbolToken string `json:"symboltoken"`
}
// GetLTP gets Last Traded Price.
func (c *Client) GetLTP(ltpParams LTPParams) (LTPResponse, error) {
var ltp LTPResponse
params := structToMap(ltpParams, "json")
err := c.doEnvelope(http.MethodPost, URILTP, params, nil, <p, true)
return ltp, err
}