Documentation
¶
Index ¶
- Constants
- func GetLoginURL(apiKey string) string
- type APIError
- type AlertRequest
- type AlertResponse
- type BasketMarginRequest
- type CancelOrderRequest
- type Candle
- type Client
- func (c *Client) BasketMargin(ctx context.Context, req BasketMarginRequest) (map[string]any, error)
- func (c *Client) BrokerMessage(ctx context.Context) ([]map[string]any, error)
- func (c *Client) CancelAlert(ctx context.Context, req AlertRequest) (*AlertResponse, error)
- func (c *Client) CancelGTTOrder(ctx context.Context, req GTTOrderRequest) (map[string]any, error)
- func (c *Client) CancelOCOOrder(ctx context.Context, req OCOOrderRequest) (map[string]any, error)
- func (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*OrderResponse, error)
- func (c *Client) CancelPayout(ctx context.Context, req PayoutRequest) (map[string]any, error)
- func (c *Client) Do(req *http.Request, out any) error
- func (c *Client) EODChartData(ctx context.Context, req EODChartDataRequest) ([]map[string]any, error)
- func (c *Client) EnabledAlertTypes(ctx context.Context) ([]map[string]any, error)
- func (c *Client) EnabledGTTs(ctx context.Context) ([]map[string]any, error)
- func (c *Client) ExchangeMessage(ctx context.Context, req ExchangeRequest) ([]map[string]any, error)
- func (c *Client) ExitSNOOrder(ctx context.Context, req CancelOrderRequest) (*OrderResponse, error)
- func (c *Client) FundsPayout(ctx context.Context, req PayoutRequest) (map[string]any, error)
- func (c *Client) GenerateSession(ctx context.Context, req SessionRequest) (*SessionResponse, error)
- func (c *Client) GetLoginURL() string
- func (c *Client) GetQuotes(ctx context.Context, req QuoteRequest) (*Quote, error)
- func (c *Client) Holdings(ctx context.Context) ([]Holding, error)
- func (c *Client) IndexList(ctx context.Context, req ExchangeRequest) ([]map[string]any, error)
- func (c *Client) Limits(ctx context.Context) (*Limits, error)
- func (c *Client) MaxPayoutAmount(ctx context.Context) (map[string]any, error)
- func (c *Client) ModifyAlert(ctx context.Context, req AlertRequest) (*AlertResponse, error)
- func (c *Client) ModifyGTTOrder(ctx context.Context, req GTTOrderRequest) (map[string]any, error)
- func (c *Client) ModifyOCOOrder(ctx context.Context, req OCOOrderRequest) (map[string]any, error)
- func (c *Client) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (*OrderResponse, error)
- func (c *Client) MultiLegOrderBook(ctx context.Context) ([]OrderBookEntry, error)
- func (c *Client) NewRequest(ctx context.Context, method, path string, payload any) (*http.Request, error)
- func (c *Client) OptionChain(ctx context.Context, req OptionChainRequest) ([]map[string]any, error)
- func (c *Client) OptionGreek(ctx context.Context, req OptionGreekRequest) (map[string]any, error)
- func (c *Client) OrderBook(ctx context.Context) ([]OrderBookEntry, error)
- func (c *Client) OrderMargin(ctx context.Context, req OrderMarginRequest) (map[string]any, error)
- func (c *Client) PayinReport(ctx context.Context) ([]map[string]any, error)
- func (c *Client) PayoutReport(ctx context.Context) ([]map[string]any, error)
- func (c *Client) PendingAlerts(ctx context.Context) ([]map[string]any, error)
- func (c *Client) PendingGTTOrders(ctx context.Context) ([]map[string]any, error)
- func (c *Client) PlaceGTTOrder(ctx context.Context, req GTTOrderRequest) (map[string]any, error)
- func (c *Client) PlaceOCOOrder(ctx context.Context, req OCOOrderRequest) (map[string]any, error)
- func (c *Client) PlaceOrder(ctx context.Context, req OrderRequest) (*OrderResponse, error)
- func (c *Client) PositionBook(ctx context.Context) ([]PositionBookEntry, error)
- func (c *Client) ProductConversion(ctx context.Context, req ProductConversionRequest) (*OrderResponse, error)
- func (c *Client) SearchScrip(ctx context.Context, req SearchScripRequest) ([]map[string]any, error)
- func (c *Client) SetAccessToken(token string)
- func (c *Client) SetAlert(ctx context.Context, req AlertRequest) (*AlertResponse, error)
- func (c *Client) SetProxy(proxyURL string) error
- func (c *Client) SingleOrderHistory(ctx context.Context, req SingleOrderHistoryRequest) ([]OrderBookEntry, error)
- func (c *Client) SpanCalculator(ctx context.Context, req SpanCalculatorRequest) (map[string]any, error)
- func (c *Client) TimePriceSeries(ctx context.Context, req TimePriceSeriesRequest) ([]Candle, error)
- func (c *Client) TopList(ctx context.Context, req TopListRequest) ([]map[string]any, error)
- func (c *Client) TopListNames(ctx context.Context, req ExchangeRequest) ([]map[string]any, error)
- func (c *Client) TradeBook(ctx context.Context) ([]TradeBookEntry, error)
- func (c *Client) UserDetails(ctx context.Context) (*UserDetails, error)
- type EODChartDataRequest
- type Error
- type ExchangeRequest
- type GTTOrderRequest
- type Holding
- type Limits
- type LoginURLRequest
- type ModifyOrderRequest
- type OCOOrderRequest
- type Option
- type OptionChainRequest
- type OptionGreekRequest
- type Order
- type OrderBookEntry
- type OrderMarginRequest
- type OrderRequest
- type OrderResponse
- type PayoutRequest
- type PositionBookEntry
- type ProductConversionRequest
- type Quote
- type QuoteRequest
- type SearchScripRequest
- type SessionRequest
- type SessionResponse
- type SingleOrderHistoryRequest
- type SpanCalculatorRequest
- type TimePriceSeriesRequest
- type TopListRequest
- type TradeBookEntry
- type UserDetails
Constants ¶
View Source
const ( DefaultBaseURL = "https://piconnect.flattrade.in/PiConnectAPI" DefaultLoginURL = "https://auth.flattrade.in/" DefaultSessionURL = "https://authapi.flattrade.in/trade/apitoken" DefaultWebSocketURL = "wss://piconnect.flattrade.in/PiConnectWSAPI/" DefaultScripMasterBaseURL = "https://flattrade.s3.ap-south-1.amazonaws.com/scripmaster" )
View Source
const ( EndpointPlaceOrder = "/PlaceOrder" EndpointModifyOrder = "/ModifyOrder" EndpointCancelOrder = "/CancelOrder" EndpointExitSNOOrder = "/ExitSNOOrder" EndpointOrderMargin = "/GetOrderMargin" EndpointBasketMargin = "/GetBasketMargin" EndpointOrderBook = "/OrderBook" EndpointMultiLegOrderBook = "/MultiLegOrderBook" EndpointSingleOrderHistory = "/SingleOrdHist" EndpointTradeBook = "/TradeBook" EndpointPositionBook = "/PositionBook" EndpointProductConversion = "/ProductConversion" )
View Source
const ( EndpointPlaceGTTOrder = "/PlaceGTTOrder" EndpointModifyGTTOrder = "/ModifyGTTOrder" EndpointCancelGTTOrder = "/CancelGTTOrder" EndpointPendingGTTOrders = "/GetPendingGTTOrder" EndpointEnabledGTTs = "/GetEnabledGTTs" EndpointPlaceOCOOrder = "/PlaceOCOOrder" EndpointModifyOCOOrder = "/ModifyOCOOrder" EndpointCancelOCOOrder = "/CancelOCOOrder" )
View Source
const ( EndpointHoldings = "/Holdings" EndpointLimits = "/Limits" )
View Source
const ( EndpointIndexList = "/GetIndexList" EndpointTopListNames = "/TopListName" EndpointTopList = "/TopList" EndpointTimePriceSeries = "/TPSeries" EndpointEODChartData = "/EODChartData" EndpointOptionChain = "/GetOptionChain" EndpointOptionGreek = "/GetOptionGreek" EndpointExchangeMessage = "/ExchMsg" EndpointBrokerMessage = "/GetBrokerMsg" EndpointSpanCalculator = "/SpanCalc" )
View Source
const ( EndpointSetAlert = "/SetAlert" EndpointCancelAlert = "/CancelAlert" EndpointModifyAlert = "/ModifyAlert" EndpointPendingAlert = "/GetPendingAlert" EndpointEnabledAlertTypes = "/GetEnabledAlertTypes" )
View Source
const ( EndpointMaxPayoutAmount = "/GetMaxPayoutAmount" EndpointFundsPayout = "/FundsPayOutReq" EndpointPayinReport = "/GetPayinReport" EndpointPayoutReport = "/GetPayoutReport" EndpointCancelPayout = "/CancelPayout" )
View Source
const ( EndpointUserDetails = "/UserDetails" EndpointSearchScrip = "/SearchScrip" EndpointGetQuotes = "/GetQuotes" )
View Source
const ( ScripMasterNSE = DefaultScripMasterBaseURL + "/NSE_Equity.csv" ScripMasterBSE = DefaultScripMasterBaseURL + "/BSE_Equity.csv" ScripMasterNFOEquity = DefaultScripMasterBaseURL + "/Nfo_Equity_Derivatives.csv" ScripMasterNFOIndex = DefaultScripMasterBaseURL + "/Nfo_Index_Derivatives.csv" ScripMasterBFOEquity = DefaultScripMasterBaseURL + "/Bfo_Equity_Derivatives.csv" ScripMasterBFOIndex = DefaultScripMasterBaseURL + "/Bfo_Index_Derivatives.csv" ScripMasterCurrency = DefaultScripMasterBaseURL + "/Currency_Derivatives.csv" ScripMasterCommodity = DefaultScripMasterBaseURL + "/Commodity.csv" )
Variables ¶
This section is empty.
Functions ¶
func GetLoginURL ¶
Types ¶
type AlertRequest ¶
type AlertRequest struct {
UserID string `json:"uid,omitempty"`
AlertID string `json:"al_id,omitempty"`
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Price string `json:"prc,omitempty"`
AlertType string `json:"al_type,omitempty"`
Condition string `json:"condition,omitempty"`
Remarks string `json:"remarks,omitempty"`
}
type AlertResponse ¶
type AlertResponse struct {
AlertID string `json:"al_id,omitempty"`
}
type BasketMarginRequest ¶
type BasketMarginRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
Orders []OrderRequest `json:"basketlists,omitempty"`
}
type CancelOrderRequest ¶
type Candle ¶
type Candle struct {
Time time.Time `json:"time,omitempty"`
Open string `json:"into,omitempty"`
High string `json:"inth,omitempty"`
Low string `json:"intl,omitempty"`
Close string `json:"intc,omitempty"`
Volume string `json:"intv,omitempty"`
OpenInt string `json:"intoi,omitempty"`
Value string `json:"v,omitempty"`
}
func (*Candle) UnmarshalJSON ¶ added in v1.0.2
type Client ¶
type Client struct {
BaseURL string
HTTPClient *http.Client
UserID string
AccountID string
APIKey string
APISecret string
AccessToken string
}
func (*Client) BasketMargin ¶
func (*Client) BrokerMessage ¶
func (*Client) CancelAlert ¶
func (c *Client) CancelAlert(ctx context.Context, req AlertRequest) (*AlertResponse, error)
func (*Client) CancelGTTOrder ¶
func (*Client) CancelOCOOrder ¶
func (*Client) CancelOrder ¶
func (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*OrderResponse, error)
func (*Client) CancelPayout ¶
func (*Client) EODChartData ¶
func (*Client) EnabledAlertTypes ¶
func (*Client) EnabledGTTs ¶
func (*Client) ExchangeMessage ¶
func (*Client) ExitSNOOrder ¶
func (c *Client) ExitSNOOrder(ctx context.Context, req CancelOrderRequest) (*OrderResponse, error)
func (*Client) FundsPayout ¶
func (*Client) GenerateSession ¶
func (c *Client) GenerateSession(ctx context.Context, req SessionRequest) (*SessionResponse, error)
func (*Client) GetLoginURL ¶
func (*Client) MaxPayoutAmount ¶
func (*Client) ModifyAlert ¶
func (c *Client) ModifyAlert(ctx context.Context, req AlertRequest) (*AlertResponse, error)
func (*Client) ModifyGTTOrder ¶
func (*Client) ModifyOCOOrder ¶
func (*Client) ModifyOrder ¶
func (c *Client) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (*OrderResponse, error)
func (*Client) MultiLegOrderBook ¶
func (c *Client) MultiLegOrderBook(ctx context.Context) ([]OrderBookEntry, error)
func (*Client) NewRequest ¶
func (*Client) OptionChain ¶
func (*Client) OptionGreek ¶
func (*Client) OrderBook ¶
func (c *Client) OrderBook(ctx context.Context) ([]OrderBookEntry, error)
func (*Client) OrderMargin ¶
func (*Client) PayinReport ¶
func (*Client) PayoutReport ¶
func (*Client) PendingAlerts ¶
func (*Client) PendingGTTOrders ¶
func (*Client) PlaceGTTOrder ¶
func (*Client) PlaceOCOOrder ¶
func (*Client) PlaceOrder ¶
func (c *Client) PlaceOrder(ctx context.Context, req OrderRequest) (*OrderResponse, error)
func (*Client) PositionBook ¶
func (c *Client) PositionBook(ctx context.Context) ([]PositionBookEntry, error)
func (*Client) ProductConversion ¶
func (c *Client) ProductConversion(ctx context.Context, req ProductConversionRequest) (*OrderResponse, error)
func (*Client) SearchScrip ¶
func (*Client) SetAccessToken ¶
func (*Client) SetAlert ¶
func (c *Client) SetAlert(ctx context.Context, req AlertRequest) (*AlertResponse, error)
func (*Client) SingleOrderHistory ¶
func (c *Client) SingleOrderHistory(ctx context.Context, req SingleOrderHistoryRequest) ([]OrderBookEntry, error)
func (*Client) SpanCalculator ¶
func (*Client) TimePriceSeries ¶
func (*Client) TopListNames ¶
func (*Client) TradeBook ¶
func (c *Client) TradeBook(ctx context.Context) ([]TradeBookEntry, error)
func (*Client) UserDetails ¶
func (c *Client) UserDetails(ctx context.Context) (*UserDetails, error)
type EODChartDataRequest ¶
type ExchangeRequest ¶
type GTTOrderRequest ¶
type GTTOrderRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
AlertID string `json:"al_id,omitempty"`
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Price string `json:"prc,omitempty"`
TriggerPrice string `json:"trgprc,omitempty"`
Product string `json:"prd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
PriceType string `json:"prctyp,omitempty"`
Retention string `json:"ret,omitempty"`
Remarks string `json:"remarks,omitempty"`
}
type LoginURLRequest ¶
type LoginURLRequest struct {
APIKey string
}
type ModifyOrderRequest ¶
type ModifyOrderRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
OrderNo string `json:"norenordno,omitempty"`
Exchange string `json:"exch,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Price string `json:"prc,omitempty"`
TriggerPrice string `json:"trgprc,omitempty"`
PriceType string `json:"prctyp,omitempty"`
Retention string `json:"ret,omitempty"`
}
type OCOOrderRequest ¶
type OCOOrderRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
AlertID string `json:"al_id,omitempty"`
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Price string `json:"prc,omitempty"`
TriggerPrice string `json:"trgprc,omitempty"`
BookLossPrice string `json:"blprc,omitempty"`
BookProfitPrice string `json:"bpprc,omitempty"`
Product string `json:"prd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
PriceType string `json:"prctyp,omitempty"`
Retention string `json:"ret,omitempty"`
Remarks string `json:"remarks,omitempty"`
}
type Option ¶
type Option func(*Client)
func WithAPIKey ¶
func WithAPIKeys ¶
func WithAPISecret ¶
func WithBaseURL ¶
func WithCredentials ¶
func WithHTTPClient ¶
type OptionChainRequest ¶
type OptionGreekRequest ¶
type Order ¶
type Order struct {
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Price string `json:"prc,omitempty"`
Product string `json:"prd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
PriceType string `json:"prctyp,omitempty"`
Retention string `json:"ret,omitempty"`
}
type OrderBookEntry ¶
type OrderMarginRequest ¶
type OrderMarginRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Price string `json:"prc,omitempty"`
Product string `json:"prd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
PriceType string `json:"prctyp,omitempty"`
}
type OrderRequest ¶
type OrderRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
DisclosedQty string `json:"dscqty,omitempty"`
Price string `json:"prc,omitempty"`
TriggerPrice string `json:"trgprc,omitempty"`
Product string `json:"prd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
PriceType string `json:"prctyp,omitempty"`
Retention string `json:"ret,omitempty"`
Remarks string `json:"remarks,omitempty"`
}
type OrderResponse ¶
type OrderResponse struct {
OrderNo string `json:"norenordno,omitempty"`
}
type PayoutRequest ¶
type PositionBookEntry ¶
type PositionBookEntry struct {
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Product string `json:"prd,omitempty"`
NetQuantity string `json:"netqty,omitempty"`
BuyQuantity string `json:"daybuyqty,omitempty"`
SellQuantity string `json:"daysellqty,omitempty"`
NetAverage string `json:"netavgprc,omitempty"`
}
type ProductConversionRequest ¶
type ProductConversionRequest struct {
UserID string `json:"uid,omitempty"`
AccountID string `json:"actid,omitempty"`
Exchange string `json:"exch,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Product string `json:"prd,omitempty"`
PreviousProduct string `json:"prevprd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
PositionType string `json:"postype,omitempty"`
}
type Quote ¶
type Quote struct {
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
LastPrice string `json:"lp,omitempty"`
Open string `json:"o,omitempty"`
High string `json:"h,omitempty"`
Low string `json:"l,omitempty"`
Close string `json:"c,omitempty"`
}
type QuoteRequest ¶
type SearchScripRequest ¶
type SessionRequest ¶
type SessionResponse ¶
type SpanCalculatorRequest ¶
type TimePriceSeriesRequest ¶
type TopListRequest ¶
type TradeBookEntry ¶
type TradeBookEntry struct {
OrderNo string `json:"norenordno,omitempty"`
Exchange string `json:"exch,omitempty"`
Token string `json:"token,omitempty"`
TradingSymbol string `json:"tsym,omitempty"`
Quantity string `json:"qty,omitempty"`
Price string `json:"prc,omitempty"`
Product string `json:"prd,omitempty"`
TransactionType string `json:"trantype,omitempty"`
TradeNo string `json:"flid,omitempty"`
TradeTime string `json:"fltm,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.