Documentation ¶
Index ¶
- Constants
- func DPanicf(template string, args ...interface{})
- func Debugf(template string, args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Infof(template string, args ...interface{})
- func Panicf(template string, args ...interface{})
- func Warnf(template string, args ...interface{})
- type AccountChanges
- type AccountInfo
- type AccountInstruments
- type AccountProperties
- type AccountSummary
- type BidAskCandles
- type BrokerBook
- type Bucket
- type CancelledOrder
- type Candle
- type Candles
- type ClosePositionPayload
- type CloseTradePayload
- type Connection
- type Headers
- type InstrumentHistory
- type InstrumentPricing
- type ModifiedTrade
- type OandaConnection
- func (c *OandaConnection) CancelOrder(orderSpecifier string) (CancelledOrder, error)
- func (c *OandaConnection) ClosePosition(instrument string, body ClosePositionPayload) (ModifiedTrade, error)
- func (c *OandaConnection) CloseTrade(tradeId string) (ModifiedTrade, error)
- func (c *OandaConnection) CreateOrder(body OrderPayload) (OrderResponse, error)
- func (c *OandaConnection) GetAccount(id string) (AccountInfo, error)
- func (c *OandaConnection) GetAccountChanges(id string, transactionId string) (AccountChanges, error)
- func (c *OandaConnection) GetAccountInstruments(id string) (AccountInstruments, error)
- func (c *OandaConnection) GetAccountSummary() (AccountSummary, error)
- func (c *OandaConnection) GetAccounts() (AccountProperties, error)
- func (c *OandaConnection) GetBidAskCandles(instrument string, count string, granularity string) (BidAskCandles, error)
- func (c *OandaConnection) GetCandles(instrument string, count string, granularity string) (InstrumentHistory, error)
- func (c *OandaConnection) GetInstrumentPrice(instrument string) (InstrumentPricing, error)
- func (c *OandaConnection) GetOpenPositions() (OpenPositions, error)
- func (c *OandaConnection) GetOpenTrades() (ReceivedTrades, error)
- func (c *OandaConnection) GetOrder(orderSpecifier string) (RetrievedOrder, error)
- func (c *OandaConnection) GetOrderDetails(instrument string, units string) (OrderDetails, error)
- func (c *OandaConnection) GetOrders(instrument string) (RetrievedOrders, error)
- func (c *OandaConnection) GetPendingOrders() (RetrievedOrders, error)
- func (c *OandaConnection) GetPricingForInstruments(instruments []string) (Pricings, error)
- func (c *OandaConnection) GetTrade(ticket string) (ReceivedTrade, error)
- func (c *OandaConnection) GetTradesForInstrument(instrument string) (ReceivedTrades, error)
- func (c *OandaConnection) GetTransaction(ticket string) (Transaction, error)
- func (c *OandaConnection) GetTransactions(from time.Time, to time.Time) (TransactionPages, error)
- func (c *OandaConnection) GetTransactionsSinceId(id string) (Transactions, error)
- func (c *OandaConnection) OrderBook(instrument string) (BrokerBook, error)
- func (c *OandaConnection) OrderReplace(orderId string, body OrderPayload) (RetrievedOrder, error)
- func (c *OandaConnection) PositionBook(instrument string) (BrokerBook, error)
- func (c *OandaConnection) ReduceTradeSize(ticket string, body CloseTradePayload) (ModifiedTrade, error)
- func (c *OandaConnection) Request(endpoint string) ([]byte, error)
- func (c *OandaConnection) Send(endpoint string, data []byte) ([]byte, error)
- func (c *OandaConnection) Update(endpoint string, data []byte) ([]byte, error)
- func (c *OandaConnection) UpdateOrder(orderSpecifier string, body OrderPayload) (RetrievedOrder, error)
- type OandaPricingStreamMessage
- type OandaTransactionStreamMessage
- type OnFill
- type OpenPositions
- type OrderBody
- type OrderDetails
- type OrderExtensions
- type OrderInfo
- type OrderPayload
- type OrderReplace
- type OrderResponse
- type PriceBucket
- type Pricings
- type ReceivedTrade
- type ReceivedTrades
- type RetrievedOrder
- type RetrievedOrders
- type StopLossOrder
- type StreamMsgType
- type TakeProfitOrder
- type TradeOpened
- type TradesClosed
- type Transaction
- type TransactionPages
- type Transactions
Constants ¶
View Source
const OANDA_AGENT string = "v20-golang/0.0.1"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountChanges ¶
type AccountChanges struct { Changes struct { OrdersCancelled []interface{} `json:"ordersCancelled"` OrdersCreated []interface{} `json:"ordersCreated"` OrdersFilled []struct { CreateTime time.Time `json:"createTime"` FilledTime time.Time `json:"filledTime"` FillingTransactionID string `json:"fillingTransactionID"` ID string `json:"id"` Instrument string `json:"instrument"` PositionFill string `json:"positionFill"` State string `json:"state"` TimeInForce string `json:"timeInForce"` TradeOpenedID string `json:"tradeOpenedID"` Type string `json:"type"` Units string `json:"units"` } `json:"ordersFilled"` OrdersTriggered []interface{} `json:"ordersTriggered"` Positions []struct { Instrument string `json:"instrument"` Long struct { Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Units string `json:"units"` } `json:"long"` Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Short struct { AveragePrice string `json:"averagePrice"` Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` TradeIDs []string `json:"tradeIDs"` Units string `json:"units"` } `json:"short"` } `json:"positions"` TradesClosed []interface{} `json:"tradesClosed"` TradesOpened []struct { CurrentUnits string `json:"currentUnits"` Financing string `json:"financing"` ID string `json:"id"` InitialUnits string `json:"initialUnits"` Instrument string `json:"instrument"` OpenTime time.Time `json:"openTime"` Price string `json:"price"` RealizedPL string `json:"realizedPL"` State string `json:"state"` } `json:"tradesOpened"` TradesReduced []interface{} `json:"tradesReduced"` Transactions []struct { AccountID string `json:"accountID"` BatchID string `json:"batchID"` ID string `json:"id"` Instrument string `json:"instrument"` PositionFill string `json:"positionFill,omitempty"` Reason string `json:"reason"` Time time.Time `json:"time"` TimeInForce string `json:"timeInForce,omitempty"` Type string `json:"type"` Units string `json:"units"` UserID int `json:"userID"` AccountBalance string `json:"accountBalance,omitempty"` Financing string `json:"financing,omitempty"` OrderID string `json:"orderID,omitempty"` Pl string `json:"pl,omitempty"` Price string `json:"price,omitempty"` TradeOpened struct { TradeID string `json:"tradeID"` Units string `json:"units"` } `json:"tradeOpened,omitempty"` } `json:"transactions"` } `json:"changes"` LastTransactionID string `json:"lastTransactionID"` State struct { NAV string `json:"NAV"` MarginAvailable string `json:"marginAvailable"` MarginCloseoutMarginUsed string `json:"marginCloseoutMarginUsed"` MarginCloseoutNAV string `json:"marginCloseoutNAV"` MarginCloseoutPercent string `json:"marginCloseoutPercent"` MarginCloseoutUnrealizedPL string `json:"marginCloseoutUnrealizedPL"` MarginUsed string `json:"marginUsed"` Orders []interface{} `json:"orders"` PositionValue string `json:"positionValue"` Positions []struct { Instrument string `json:"instrument"` LongUnrealizedPL string `json:"longUnrealizedPL"` NetUnrealizedPL string `json:"netUnrealizedPL"` ShortUnrealizedPL string `json:"shortUnrealizedPL"` } `json:"positions"` Trades []struct { ID string `json:"id"` UnrealizedPL string `json:"unrealizedPL"` } `json:"trades"` UnrealizedPL string `json:"unrealizedPL"` WithdrawalLimit string `json:"withdrawalLimit"` } `json:"state"` ErrorMessage string `json:"errorMessage"` }
type AccountInfo ¶
type AccountInfo struct { Account struct { NAV string `json:"NAV"` Alias string `json:"alias"` Balance string `json:"balance"` CreatedByUserID int `json:"createdByUserID"` CreatedTime time.Time `json:"createdTime"` Currency string `json:"currency"` HedgingEnabled bool `json:"hedgingEnabled"` ID string `json:"id"` LastTransactionID string `json:"lastTransactionID"` MarginAvailable string `json:"marginAvailable"` MarginCloseoutMarginUsed string `json:"marginCloseoutMarginUsed"` MarginCloseoutNAV string `json:"marginCloseoutNAV"` MarginCloseoutPercent string `json:"marginCloseoutPercent"` MarginCloseoutPositionValue string `json:"marginCloseoutPositionValue"` MarginCloseoutUnrealizedPL string `json:"marginCloseoutUnrealizedPL"` MarginRate string `json:"marginRate"` MarginUsed string `json:"marginUsed"` OpenPositionCount int `json:"openPositionCount"` OpenTradeCount int `json:"openTradeCount"` Orders []interface{} `json:"orders"` PendingOrderCount int `json:"pendingOrderCount"` Pl string `json:"pl"` PositionValue string `json:"positionValue"` Positions []struct { Instrument string `json:"instrument"` Long struct { Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Units string `json:"units"` UnrealizedPL string `json:"unrealizedPL"` } `json:"long"` Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Short struct { Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Units string `json:"units"` UnrealizedPL string `json:"unrealizedPL"` } `json:"short"` UnrealizedPL string `json:"unrealizedPL"` } `json:"positions"` ResettablePL string `json:"resettablePL"` Trades []interface{} `json:"trades"` UnrealizedPL string `json:"unrealizedPL"` WithdrawalLimit string `json:"withdrawalLimit"` } `json:"account"` LastTransactionID string `json:"lastTransactionID"` ErrorMessage string `json:"errorMessage"` }
type AccountInstruments ¶
type AccountInstruments struct { Instruments []struct { DisplayName string `json:"displayName"` DisplayPrecision int `json:"displayPrecision"` MarginRate string `json:"marginRate"` MaximumOrderUnits string `json:"maximumOrderUnits"` MaximumPositionSize string `json:"maximumPositionSize"` MaximumTrailingStopDistance string `json:"maximumTrailingStopDistance"` MinimumTradeSize string `json:"minimumTradeSize"` MinimumTrailingStopDistance string `json:"minimumTrailingStopDistance"` Name string `json:"name"` PipLocation int `json:"pipLocation"` TradeUnitsPrecision int `json:"tradeUnitsPrecision"` Type string `json:"type"` } `json:"instruments"` ErrorMessage string `json:"errorMessage"` }
type AccountProperties ¶
type AccountSummary ¶
type AccountSummary struct { Account struct { NAV string `json:"NAV"` Alias string `json:"alias"` Balance float64 `json:"balance,string"` CreatedByUserID int `json:"createdByUserID"` CreatedTime time.Time `json:"createdTime"` Currency string `json:"currency"` HedgingEnabled bool `json:"hedgingEnabled"` ID string `json:"id"` LastTransactionID string `json:"lastTransactionID"` MarginAvailable float64 `json:"marginAvailable,string"` MarginCloseoutMarginUsed string `json:"marginCloseoutMarginUsed"` MarginCloseoutNAV string `json:"marginCloseoutNAV"` MarginCloseoutPercent string `json:"marginCloseoutPercent"` MarginCloseoutPositionValue string `json:"marginCloseoutPositionValue"` MarginCloseoutUnrealizedPL string `json:"marginCloseoutUnrealizedPL"` MarginRate string `json:"marginRate"` MarginUsed string `json:"marginUsed"` OpenPositionCount int `json:"openPositionCount"` OpenTradeCount int `json:"openTradeCount"` PendingOrderCount int `json:"pendingOrderCount"` Pl string `json:"pl"` PositionValue string `json:"positionValue"` ResettablePL string `json:"resettablePL"` UnrealizedPL string `json:"unrealizedPL"` WithdrawalLimit string `json:"withdrawalLimit"` } `json:"account"` LastTransactionID string `json:"lastTransactionID"` ErrorMessage string `json:"errorMessage"` }
type BidAskCandles ¶
type BidAskCandles struct { Candles []struct { Ask struct { C float64 `json:"c,string"` H float64 `json:"h,string"` L float64 `json:"l,string"` O float64 `json:"o,string"` } `json:"ask"` Bid struct { C float64 `json:"c,string"` H float64 `json:"h,string"` L float64 `json:"l,string"` O float64 `json:"o,string"` } `json:"bid"` Complete bool `json:"complete"` Time time.Time `json:"time"` Volume int `json:"volume"` } `json:"candles"` ErrorMessage string `json:"errorMessage"` }
type BrokerBook ¶
type Bucket ¶
type CancelledOrder ¶
type CancelledOrder struct { OrderCancelTransaction struct { ID string `json:"id"` Time time.Time `json:"time"` UserID int `json:"userID"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` RequestID string `json:"requestID"` Type string `json:"type"` OrderID string `json:"orderID"` ClientOrderID string `json:"clientOrderID"` Reason string `json:"reason"` ReplacedByOrderID string `json:"replacedByOrderID"` } `json:"orderCancelTransaction"` RelatedTransactionIDs []string `json:"relatedTransactionIDs"` LastTransactionID string `json:"lastTransactionID"` ErrorMessage string `json:"errorMessage"` }
type Candle ¶
type Candles ¶
type ClosePositionPayload ¶
type Connection ¶
type Connection interface { Request(endpoint string) []byte Send(endpoint string, data []byte) []byte Update(endpoint string, data []byte) []byte GetOrderDetails(instrument string, units string) OrderDetails GetAccountSummary() (AccountSummary, error) CreateOrder(body OrderPayload) OrderResponse }
type Headers ¶
type Headers struct { DatetimeFormat string // contains filtered or unexported fields }
type InstrumentHistory ¶
type InstrumentPricing ¶
type InstrumentPricing struct { Time time.Time `json:"time"` Prices []struct { Type string `json:"type"` Time time.Time `json:"time"` Bids []struct { Price float64 `json:"price,string"` Liquidity int `json:"liquidity"` } `json:"bids"` Asks []struct { Price float64 `json:"price,string"` Liquidity int `json:"liquidity"` } `json:"asks"` CloseoutBid float64 `json:"closeoutBid,string"` CloseoutAsk float64 `json:"closeoutAsk,string"` Status string `json:"status"` Tradeable bool `json:"tradeable"` UnitsAvailable struct { Default struct { Long string `json:"long"` Short string `json:"short"` } `json:"default"` OpenOnly struct { Long string `json:"long"` Short string `json:"short"` } `json:"openOnly"` ReduceFirst struct { Long string `json:"long"` Short string `json:"short"` } `json:"reduceFirst"` ReduceOnly struct { Long string `json:"long"` Short string `json:"short"` } `json:"reduceOnly"` } `json:"unitsAvailable"` QuoteHomeConversionFactors struct { PositiveUnits string `json:"positiveUnits"` NegativeUnits string `json:"negativeUnits"` } `json:"quoteHomeConversionFactors"` Instrument string `json:"instrument"` } `json:"prices"` ErrorMessage string `json:"errorMessage"` }
type ModifiedTrade ¶
type ModifiedTrade struct { OrderCreateTransaction struct { Type string `json:"type"` Instrument string `json:"instrument"` Units string `json:"units"` TimeInForce string `json:"timeInForce"` PositionFill string `json:"positionFill"` Reason string `json:"reason"` TradeClose struct { Units string `json:"units"` TradeID string `json:"tradeID"` } `json:"tradeClose"` ID string `json:"id"` UserID int `json:"userID"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` RequestID string `json:"requestID"` Time time.Time `json:"time"` } `json:"orderCreateTransaction"` OrderFillTransaction struct { Type string `json:"type"` Instrument string `json:"instrument"` Units string `json:"units"` Price string `json:"price"` FullPrice string `json:"fullPrice"` PL string `json:"pl"` Financing string `json:"financing"` Commission string `json:"commission"` AccountBalance string `json:"accountBalance"` TradeOpened string `json:"tradeOpened"` TimeInForce string `json:"timeInForce"` PositionFill string `json:"positionFill"` Reason string `json:"reason"` TradesClosed []struct { TradeID string `json:"tradeID"` Units string `json:"units"` RealizedPL string `json:"realizedPL"` Financing string `json:"financing"` } `json:"tradesClosed"` TradeReduced struct { TradeID string `json:"tradeID"` Units string `json:"units"` RealizedPL string `json:"realizedPL"` Financing string `json:"financing"` } `json:"tradeReduced"` ID string `json:"id"` UserID int `json:"userID"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` RequestID string `json:"requestID"` OrderID string `json:"orderId"` ClientOrderID string `json:"clientOrderId"` Time time.Time `json:"time"` } `json:"orderFillTransaction"` OrderCancelTransaction struct { Type string `json:"type"` OrderID string `json:"orderID"` Reason string `json:"reason"` ID string `json:"id"` UserID int `json:"userID"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` RequestID string `json:"requestID"` Time time.Time `json:"time"` } `json:"orderCancelTransaction"` RelatedTransactionIDs []string `json:"relatedTransactionIDs"` LastTransactionID string `json:"lastTransactionID"` ErrorMessage string `json:"errorMessage"` }
type OandaConnection ¶
type OandaConnection struct { DatetimeFormat string // contains filtered or unexported fields }
func NewConnection ¶
func NewConnection(accountID string, token string, live bool) *OandaConnection
func (*OandaConnection) CancelOrder ¶
func (c *OandaConnection) CancelOrder(orderSpecifier string) (CancelledOrder, error)
func (*OandaConnection) ClosePosition ¶
func (c *OandaConnection) ClosePosition(instrument string, body ClosePositionPayload) (ModifiedTrade, error)
func (*OandaConnection) CloseTrade ¶
func (c *OandaConnection) CloseTrade(tradeId string) (ModifiedTrade, error)
func (*OandaConnection) CreateOrder ¶
func (c *OandaConnection) CreateOrder(body OrderPayload) (OrderResponse, error)
func (*OandaConnection) GetAccount ¶
func (c *OandaConnection) GetAccount(id string) (AccountInfo, error)
func (*OandaConnection) GetAccountChanges ¶
func (c *OandaConnection) GetAccountChanges(id string, transactionId string) (AccountChanges, error)
func (*OandaConnection) GetAccountInstruments ¶
func (c *OandaConnection) GetAccountInstruments(id string) (AccountInstruments, error)
func (*OandaConnection) GetAccountSummary ¶
func (c *OandaConnection) GetAccountSummary() (AccountSummary, error)
func (*OandaConnection) GetAccounts ¶
func (c *OandaConnection) GetAccounts() (AccountProperties, error)
func (*OandaConnection) GetBidAskCandles ¶
func (c *OandaConnection) GetBidAskCandles(instrument string, count string, granularity string) (BidAskCandles, error)
func (*OandaConnection) GetCandles ¶
func (c *OandaConnection) GetCandles(instrument string, count string, granularity string) (InstrumentHistory, error)
func (*OandaConnection) GetInstrumentPrice ¶
func (c *OandaConnection) GetInstrumentPrice(instrument string) (InstrumentPricing, error)
func (*OandaConnection) GetOpenPositions ¶
func (c *OandaConnection) GetOpenPositions() (OpenPositions, error)
func (*OandaConnection) GetOpenTrades ¶
func (c *OandaConnection) GetOpenTrades() (ReceivedTrades, error)
func (*OandaConnection) GetOrder ¶
func (c *OandaConnection) GetOrder(orderSpecifier string) (RetrievedOrder, error)
func (*OandaConnection) GetOrderDetails ¶
func (c *OandaConnection) GetOrderDetails(instrument string, units string) (OrderDetails, error)
func (*OandaConnection) GetOrders ¶
func (c *OandaConnection) GetOrders(instrument string) (RetrievedOrders, error)
func (*OandaConnection) GetPendingOrders ¶
func (c *OandaConnection) GetPendingOrders() (RetrievedOrders, error)
func (*OandaConnection) GetPricingForInstruments ¶
func (c *OandaConnection) GetPricingForInstruments(instruments []string) (Pricings, error)
func (*OandaConnection) GetTrade ¶
func (c *OandaConnection) GetTrade(ticket string) (ReceivedTrade, error)
func (*OandaConnection) GetTradesForInstrument ¶
func (c *OandaConnection) GetTradesForInstrument(instrument string) (ReceivedTrades, error)
func (*OandaConnection) GetTransaction ¶
func (c *OandaConnection) GetTransaction(ticket string) (Transaction, error)
func (*OandaConnection) GetTransactions ¶
func (c *OandaConnection) GetTransactions(from time.Time, to time.Time) (TransactionPages, error)
https://golang.org/pkg/time/#Time.AddDate https://play.golang.org/p/Dw7D4JJ7EC
func (*OandaConnection) GetTransactionsSinceId ¶
func (c *OandaConnection) GetTransactionsSinceId(id string) (Transactions, error)
func (*OandaConnection) OrderBook ¶
func (c *OandaConnection) OrderBook(instrument string) (BrokerBook, error)
func (*OandaConnection) OrderReplace ¶
func (c *OandaConnection) OrderReplace(orderId string, body OrderPayload) (RetrievedOrder, error)
func (*OandaConnection) PositionBook ¶
func (c *OandaConnection) PositionBook(instrument string) (BrokerBook, error)
func (*OandaConnection) ReduceTradeSize ¶
func (c *OandaConnection) ReduceTradeSize(ticket string, body CloseTradePayload) (ModifiedTrade, error)
Default is close the whole position using the string "ALL" in body.units
func (*OandaConnection) Request ¶
func (c *OandaConnection) Request(endpoint string) ([]byte, error)
TODO: include params as a second option
func (*OandaConnection) Send ¶
func (c *OandaConnection) Send(endpoint string, data []byte) ([]byte, error)
func (*OandaConnection) Update ¶
func (c *OandaConnection) Update(endpoint string, data []byte) ([]byte, error)
func (*OandaConnection) UpdateOrder ¶
func (c *OandaConnection) UpdateOrder(orderSpecifier string, body OrderPayload) (RetrievedOrder, error)
type OandaPricingStreamMessage ¶
type OandaPricingStreamMessage struct { Type StreamMsgType Time time.Time Instrument string Bids []PriceBucket Asks []PriceBucket CloseoutBid decimal.Decimal CloseoutAsk decimal.Decimal }
type OandaTransactionStreamMessage ¶
type OandaTransactionStreamMessage struct { Type StreamMsgType Instrument string Units string Price string TimeInForce string TriggerCondition string PartialFill string PositionFill string RejectReason string Reason string Id string `json:"id"` AccountID string UserID int64 BatchID string RequestID string TradeID string ReplacesOrderID string `json:"replacesOrderID"` ReplacedByOrderID string `json:"replacedByOrderID"` OrderID string CancellingTransactionID string Commission string Financing string TradesClosed *[]TradesClosed TradeOpened *TradeOpened Guaranteed bool Time time.Time IntendedReplacesOrderID string }
type OnFill ¶
type OpenPositions ¶
type OpenPositions struct { LastTransactionID string `json:"lastTransactionID"` Positions []struct { Instrument string `json:"instrument"` Long struct { AveragePrice string `json:"averagePrice"` Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` TradeIDs []string `json:"tradeIDs"` Units string `json:"units"` UnrealizedPL string `json:"unrealizedPL"` } `json:"long"` Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Short struct { Pl string `json:"pl"` ResettablePL string `json:"resettablePL"` Units string `json:"units"` UnrealizedPL string `json:"unrealizedPL"` } `json:"short"` UnrealizedPL string `json:"unrealizedPL"` } `json:"positions"` }
type OrderBody ¶
type OrderBody struct { Units int `json:"units"` Instrument string `json:"instrument"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` PositionFill string `json:"positionFill,omitempty"` Price string `json:"price,omitempty"` StopLossOnFill *OnFill `json:"stopLossOnFill,omitempty"` ClientExtensions *OrderExtensions `json:"clientExtensions,omitempty"` TradeID string `json:"tradeID,omitempty"` }
type OrderDetails ¶
type OrderDetails struct { GainPerPipPerMillionUnits float64 `json:"gainPerPipPerMillionUnits,string"` LossPerPipPerMillionUnits float64 `json:"lossPerPipPerMillionUnits,string"` UnitsAvailable struct { Default struct { Long float64 `json:"long,string"` Short float64 `json:"short,string"` } `json:"default"` OpenOnly struct { Long float64 `json:"long,string"` Short float64 `json:"short,string"` } `json:"openOnly"` ReduceFirst struct { Long float64 `json:"long,string"` Short float64 `json:"short,string"` } `json:"reduceFirst"` ReduceOnly struct { Long float64 `json:"long,string"` Short float64 `json:"short,string"` } `json:"reduceOnly"` } `json:"unitsAvailable"` UnitValues struct { Isolation struct { Units float64 `json:"units,string"` Commission float64 `json:"commission,string"` PositionValueChange float64 `json:"positionValueChange,string"` PositionValue float64 `json:"positionValue,string"` MarginRequired float64 `json:"marginRequired,string"` MarginUsed float64 `json:"marginUsed,string"` } `json:"isolation"` PositionDefault struct { Units float64 `json:"units,string"` Commission float64 `json:"commission,string"` PositionValueChange float64 `json:"positionValueChange,string"` PositionValue float64 `json:"positionValue,string"` MarginRequired float64 `json:"marginRequired,string"` MarginUsed float64 `json:"marginUsed,string"` } `json:"positionDefault"` PositionOpenOnly struct { Units float64 `json:"units,string"` Commission float64 `json:"commission,string"` PositionValueChange float64 `json:"positionValueChange,string"` PositionValue float64 `json:"positionValue,string"` MarginRequired float64 `json:"marginRequired,string"` MarginUsed float64 `json:"marginUsed,string"` } `json:"positionOpenOnly"` PositionReduceFirst struct { Units float64 `json:"units,string"` Commission float64 `json:"commission,string"` PositionValueChange float64 `json:"positionValueChange,string"` PositionValue float64 `json:"positionValue,string"` MarginRequired float64 `json:"marginRequired,string"` MarginUsed float64 `json:"marginUsed,string"` } `json:"positionReduceFirst"` PositionReduceOnly struct { Units float64 `json:"units,string"` Commission float64 `json:"commission,string"` PositionValueChange float64 `json:"positionValueChange,string"` PositionValue float64 `json:"positionValue,string"` MarginRequired float64 `json:"marginRequired,string"` MarginUsed float64 `json:"marginUsed,string"` } `json:"positionReduceOnly"` } `json:"unitValues"` ValueTables struct { CommissionTable []struct { Units string `json:"units"` Value string `json:"value"` } `json:"commissionTable"` } `json:"valueTables"` LastTransactionID string `json:"lastTransactionID"` ErrorMessage string `json:"errorMessage"` }
type OrderExtensions ¶
type OrderInfo ¶
type OrderInfo struct { ClientExtensions struct { Comment string `json:"comment,omitempty"` ID string `json:"id,omitempty"` Tag string `json:"tag,omitempty"` } `json:"clientExtensions,omitempty"` CreateTime time.Time `json:"createTime"` ID string `json:"id"` Instrument string `json:"instrument,omitempty"` PartialFill string `json:"partialFill"` PositionFill string `json:"positionFill"` Price string `json:"price"` ReplacesOrderID string `json:"replacesOrderID,omitempty"` State string `json:"state"` TimeInForce string `json:"timeInForce"` TriggerCondition string `json:"triggerCondition"` Type string `json:"type"` Units string `json:"units,omitempty"` TradeID string `json:"tradeID,omitempty"` ErrorMessage string `json:"errorMessage"` }
type OrderReplace ¶
type OrderReplace struct { OrderCancelTransaction struct { ID string `json:"id"` Time time.Time `json:"time"` UserID int `json:"userID"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` RequestID string `json:"requestID"` Type string `json:"type"` OrderID string `json:"orderID"` ClientOrderID string `json:"clientOrderID"` Reason string `json:"reason"` ReplacedByOrderID string `json:"replacedByOrderID"` } `json:"orderCancelTransaction"` RelatedTransactionIDs []string `json:"relatedTransactionIDs"` LastTransactionID string `json:"lastTransactionID"` ErrorMessage string `json:"errorMessage"` }
type OrderResponse ¶
type OrderResponse struct { LastTransactionID string `json:"lastTransactionID"` OrderCreateTransaction struct { AccountID string `json:"accountID"` BatchID string `json:"batchID"` ID string `json:"id"` Instrument string `json:"instrument"` PositionFill string `json:"positionFill"` Reason string `json:"reason"` Time time.Time `json:"time"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Units string `json:"units"` UserID int `json:"userID"` } `json:"orderCreateTransaction"` OrderFillTransaction struct { AccountBalance string `json:"accountBalance"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` Financing string `json:"financing"` ID string `json:"id"` Instrument string `json:"instrument"` OrderID string `json:"orderID"` Pl string `json:"pl"` Price string `json:"price"` Reason string `json:"reason"` Time time.Time `json:"time"` TradeOpened struct { TradeID string `json:"tradeID"` Units string `json:"units"` } `json:"tradeOpened"` Type string `json:"type"` Units string `json:"units"` UserID int `json:"userID"` } `json:"orderFillTransaction"` RelatedTransactionIDs []string `json:"relatedTransactionIDs"` ErrorMessage string `json:"errorMessage"` }
type Pricings ¶
type Pricings struct { Prices []struct { Asks []struct { Liquidity int `json:"liquidity"` Price string `json:"price"` } `json:"asks"` Bids []struct { Liquidity int `json:"liquidity"` Price string `json:"price"` } `json:"bids"` CloseoutAsk string `json:"closeoutAsk"` CloseoutBid string `json:"closeoutBid"` Instrument string `json:"instrument"` QuoteHomeConversionFactors struct { NegativeUnits string `json:"negativeUnits"` PositiveUnits string `json:"positiveUnits"` } `json:"quoteHomeConversionFactors"` Status string `json:"status"` Time time.Time `json:"time"` UnitsAvailable struct { Default struct { Long string `json:"long"` Short string `json:"short"` } `json:"default"` OpenOnly struct { Long string `json:"long"` Short string `json:"short"` } `json:"openOnly"` ReduceFirst struct { Long string `json:"long"` Short string `json:"short"` } `json:"reduceFirst"` ReduceOnly struct { Long string `json:"long"` Short string `json:"short"` } `json:"reduceOnly"` } `json:"unitsAvailable"` } `json:"prices"` }
type ReceivedTrade ¶
type ReceivedTrade struct { LastTransactionID string `json:"lastTransactionID"` Trades struct { CurrentUnits string `json:"currentUnits"` Financing string `json:"financing"` ID string `json:"id"` InitialUnits string `json:"initialUnits"` Instrument string `json:"instrument"` OpenTime time.Time `json:"openTime"` Price string `json:"price"` RealizedPL string `json:"realizedPL"` State string `json:"state"` UnrealizedPL string `json:"unrealizedPL"` } `json:"trade"` }
type ReceivedTrades ¶
type ReceivedTrades struct { LastTransactionID string `json:"lastTransactionID"` Trades []struct { CurrentUnits string `json:"currentUnits"` Financing string `json:"financing"` ID string `json:"id"` InitialUnits string `json:"initialUnits"` Instrument string `json:"instrument"` OpenTime time.Time `json:"openTime"` Price string `json:"price"` RealizedPL string `json:"realizedPL"` State string `json:"state"` UnrealizedPL string `json:"unrealizedPL"` StopLossOrder *StopLossOrder `json:"stopLossOrder,omitempty"` TakeProfitOrder *StopLossOrder `json:"takeProfitOrder,omitempty"` } `json:"trades"` ErrorMessage string `json:"errorMessage"` }
type RetrievedOrder ¶
type RetrievedOrders ¶
type StopLossOrder ¶
type StreamMsgType ¶
type StreamMsgType string
const ( HeartbeatType StreamMsgType = "HEARTBEAT" CreateType StreamMsgType = "CREATE" CloseType StreamMsgType = "CLOSE" ReopenType StreamMsgType = "REOPEN" ClientConfigureType StreamMsgType = "CLIENT_CONFIGURE" ClientConfigureRejectType StreamMsgType = "CLIENT_CONFIGURE_REJECT" TransferFundsType StreamMsgType = "TRANSFER_FUNDS" TransferFundsRejectType StreamMsgType = "TRANSFER_FUNDS_REJECT" MarketOrderType StreamMsgType = "MARKET_ORDER" MarketOrderRejectType StreamMsgType = "MARKET_ORDER_REJECT" FixedPriceOrderType StreamMsgType = "FIXED_PRICE_ORDER" LimitOrderType StreamMsgType = "LIMIT_ORDER" LimitOrderRejectType StreamMsgType = "LIMIT_ORDER_REJECT" StopOrderType StreamMsgType = "STOP_ORDER" StopOrderRejectType StreamMsgType = "STOP_ORDER_REJECT" MarketIfTouchedOrderType StreamMsgType = "MARKET_IF_TOUCHED_ORDER" MarketIfTouchedOrderRejectType StreamMsgType = "MARKET_IF_TOUCHED_ORDER_REJECT" TakeProfitOrderType StreamMsgType = "TAKE_PROFIT_ORDER" TakeProfitOrderRejectType StreamMsgType = "TAKE_PROFIT_ORDER_REJECT" StopLossOrderType StreamMsgType = "STOP_LOSS_ORDER" StopLossOrderRejectType StreamMsgType = "STOP_LOSS_ORDER_REJECT" TrailingStopLossOrderType StreamMsgType = "TRAILING_STOP_LOSS_ORDER" TrailingStopLossOrderRejectType StreamMsgType = "TRAILING_STOP_LOSS_ORDER_REJECT" OrderFillType StreamMsgType = "ORDER_FILL" OrderCancelType StreamMsgType = "ORDER_CANCEL" OrderCancelRejectType StreamMsgType = "ORDER_CANCEL_REJECT" OrderClientExtensionsModifyType StreamMsgType = "ORDER_CLIENT_EXTENSIONS_MODIFY" OrderClientExtensionsModifyRejectType StreamMsgType = "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT" TradeClientExtensionsModifyType StreamMsgType = "TRADE_CLIENT_EXTENSIONS_MODIFY" TradeClientExtensionsModifyRejectType StreamMsgType = "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT" MarginCallEnterType StreamMsgType = "MARGIN_CALL_ENTER" MarginCallExtendType StreamMsgType = "MARGIN_CALL_EXTEND" MarginCallExitType StreamMsgType = "MARGIN_CALL_EXIT" DelayedTradeClosureType StreamMsgType = "DELAYED_TRADE_CLOSURE" DailyFinancingType StreamMsgType = "DAILY_FINANCING" DividendType StreamMsgType = "DIVIDEND" ResetResettablePlType StreamMsgType = "RESET_RESETTABLE_PL" PriceType StreamMsgType = "PRICE" )
type TakeProfitOrder ¶
type Transaction ¶
type Transaction struct { LastTransactionID string `json:"lastTransactionID"` Transaction struct { AccountBalance string `json:"accountBalance"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` Financing string `json:"financing"` ID string `json:"id"` Instrument string `json:"instrument"` OrderID string `json:"orderID"` Pl string `json:"pl"` Price string `json:"price"` Reason string `json:"reason"` Time time.Time `json:"time"` TradeOpened struct { TradeID string `json:"tradeID"` Units string `json:"units"` } `json:"tradeOpened"` Type string `json:"type"` Units string `json:"units"` UserID int `json:"userID"` } `json:"transaction"` }
type TransactionPages ¶
type Transactions ¶
type Transactions struct { LastTransactionID string `json:"lastTransactionID"` Transactions []struct { AccountBalance string `json:"accountBalance"` AccountID string `json:"accountID"` BatchID string `json:"batchID"` Financing string `json:"financing"` ID string `json:"id"` Instrument string `json:"instrument"` OrderID string `json:"orderID"` Pl string `json:"pl"` Price string `json:"price"` Reason string `json:"reason"` Time time.Time `json:"time"` TradeOpened struct { TradeID string `json:"tradeID"` Units string `json:"units"` } `json:"tradeOpened"` Type string `json:"type"` Units string `json:"units"` UserID int `json:"userID"` } `json:"transactions"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.