Documentation ¶
Index ¶
- type AccountInstruments
- type AccountProperties
- type AccountSummary
- type AccountSummaryResponse
- type Accounts
- type ClientExtensions
- type CloseTradeResponse
- type Headers
- type Instrument
- type MarketOrderTradeClose
- type OandaClient
- func (c *OandaClient) CloseTrade(accountID, tradeID string) (CloseTradeResponse, error)
- func (c *OandaClient) CreateMarketOrder(accountID, instrument, side string, units int32) (OrderResponse, error)
- func (c *OandaClient) GetAccountInstruments(accountID string) (AccountInstruments, error)
- func (c *OandaClient) GetAccountSummary(accountID string) (AccountSummaryResponse, error)
- func (c *OandaClient) GetAccounts() (Accounts, error)
- func (c *OandaClient) GetOpenTrades(accountID string) (Trades, error)
- func (c *OandaClient) GetPrices(accountID string, instruments []string) (Pricings, error)
- func (c *OandaClient) SubscribePrices(accountID string, instruments []string, handler PriceHandler) (*PriceSubscription, error)
- func (c *OandaClient) SubscribeTransactions(accountID string, transType []TransactionType, handler TransactionHandler) error
- type Order
- type OrderCancelTransaction
- type OrderCreateTransaction
- type OrderFillTransaction
- type OrderRequest
- type OrderResponse
- type PositionFinancing
- type Price
- type PriceBucket
- type PriceHandler
- type PriceSubscription
- type Pricings
- type Trade
- type TradeFinancing
- type TradeOpened
- type TradeReduced
- type Trades
- type Transaction
- type TransactionHandler
- type TransactionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInstruments ¶
type AccountInstruments struct {
Instruments []Instrument `json:"instruments"`
}
type AccountProperties ¶
type AccountProperties struct {
ID string `json:"id"`
}
type AccountSummary ¶
type AccountSummary struct { NAV float64 `json:"NAV,string"` 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 float64 `json:"marginCloseoutMarginUsed,string"` MarginCloseoutNAV float64 `json:"marginCloseoutNAV,string"` MarginCloseoutPercent float64 `json:"marginCloseoutPercent,string"` MarginCloseoutPositionValue float64 `json:"marginCloseoutPositionValue,string"` MarginCloseoutUnrealizedPL float64 `json:"marginCloseoutUnrealizedPL,string"` MarginRate float64 `json:"marginRate,string"` MarginUsed float64 `json:"marginUsed,string"` OpenPositionCount int `json:"openPositionCount"` OpenTradeCount int `json:"openTradeCount"` PendingOrderCount int `json:"pendingOrderCount"` Pl float64 `json:"pl,string"` PositionValue float64 `json:"positionValue,string"` ResettablePL float64 `json:"resettablePL,string"` UnrealizedPL float64 `json:"unrealizedPL,string"` WithdrawalLimit float64 `json:"withdrawalLimit,string"` }
type AccountSummaryResponse ¶
type AccountSummaryResponse struct {
Account AccountSummary `json:"account"`
}
type Accounts ¶
type Accounts struct {
Accounts []AccountProperties `json:"accounts"`
}
type ClientExtensions ¶
type CloseTradeResponse ¶
type CloseTradeResponse struct { OrderCreateTransaction *OrderCreateTransaction `json:"orderCreateTransaction"` OrderFillTransaction *OrderFillTransaction `json:"orderFillTransaction"` OrderCancelTransaction *OrderCancelTransaction `json:"orderCancelTransaction"` }
type Instrument ¶
type Instrument struct { DisplayName string `json:"displayName"` DisplayPrecision int `json:"displayPrecision"` MarginRate float64 `json:"marginRate,string"` MaximumOrderUnits float64 `json:"maximumOrderUnits,string"` MaximumPositionSize float64 `json:"maximumPositionSize,string"` MaximumTrailingStopDistance float64 `json:"maximumTrailingStopDistance,string"` MinimumTradeSize float64 `json:"minimumTradeSize,string"` MinimumTrailingStopDistance float64 `json:"minimumTrailingStopDistance,string"` Name string `json:"name"` PipLocation int `json:"pipLocation"` TradeUnitsPrecision int `json:"tradeUnitsPrecision"` Type string `json:"type"` }
type MarketOrderTradeClose ¶
type OandaClient ¶
type OandaClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(token string, live bool) *OandaClient
func (*OandaClient) CloseTrade ¶
func (c *OandaClient) CloseTrade(accountID, tradeID string) (CloseTradeResponse, error)
func (*OandaClient) CreateMarketOrder ¶
func (c *OandaClient) CreateMarketOrder(accountID, instrument, side string, units int32) (OrderResponse, error)
func (*OandaClient) GetAccountInstruments ¶
func (c *OandaClient) GetAccountInstruments(accountID string) (AccountInstruments, error)
func (*OandaClient) GetAccountSummary ¶
func (c *OandaClient) GetAccountSummary(accountID string) (AccountSummaryResponse, error)
func (*OandaClient) GetAccounts ¶
func (c *OandaClient) GetAccounts() (Accounts, error)
func (*OandaClient) GetOpenTrades ¶
func (c *OandaClient) GetOpenTrades(accountID string) (Trades, error)
func (*OandaClient) GetPrices ¶
func (c *OandaClient) GetPrices(accountID string, instruments []string) (Pricings, error)
func (*OandaClient) SubscribePrices ¶
func (c *OandaClient) SubscribePrices(accountID string, instruments []string, handler PriceHandler) (*PriceSubscription, error)
func (*OandaClient) SubscribeTransactions ¶
func (c *OandaClient) SubscribeTransactions(accountID string, transType []TransactionType, handler TransactionHandler) error
type Order ¶
type Order struct { Units int32 `json:"units,string"` Instrument string `json:"instrument"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` PositionFill string `json:"positionFill,omitempty"` Price float64 `json:"price,omitempty"` ClientExtensions *ClientExtensions `json:"tradeClientExtensions,omitempty"` }
type OrderCancelTransaction ¶
type 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"` }
type OrderCreateTransaction ¶
type OrderCreateTransaction struct { AccountID string `json:"accountID"` ID string `json:"id"` Instrument string `json:"instrument"` PositionFill string `json:"positionFill"` Reason string `json:"reason"` TradeClose *MarketOrderTradeClose `json:"tradeClose"` Time time.Time `json:"time"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Units string `json:"units"` }
type OrderFillTransaction ¶
type OrderFillTransaction struct { Type string `json:"type"` Instrument string `json:"instrument"` Units string `json:"units"` PL string `json:"pl"` Financing string `json:"financing"` Commission string `json:"commission"` AccountBalance string `json:"accountBalance"` TimeInForce string `json:"timeInForce"` PositionFill string `json:"positionFill"` Reason string `json:"reason"` TradesClosed []*TradeReduced `json:"tradesClosed"` TradeReduced *TradeReduced `json:"tradeReduced"` TradeOpened *TradeOpened `json:"tradeOpened"` 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"` }
type OrderRequest ¶
type OrderRequest struct {
Order Order `json:"order"`
}
type OrderResponse ¶
type OrderResponse struct { OrderCreateTransaction *OrderCreateTransaction `json:"orderCreateTransaction"` OrderFillTransaction *OrderFillTransaction `json:"orderFillTransaction"` }
type PositionFinancing ¶
type PositionFinancing struct { Instrument string `json:"instrument"` Financing float64 `json:"financing,string"` TradesFinancing []*TradeFinancing `json:"openTradeFinancings"` }
type Price ¶
type Price struct { Asks []PriceBucket `json:"asks"` Bids []PriceBucket `json:"bids"` CloseoutAsk string `json:"closeoutAsk"` CloseoutBid string `json:"closeoutBid"` Instrument string `json:"instrument"` Time time.Time `json:"time"` }
type PriceBucket ¶
type PriceHandler ¶
type PriceHandler func(price Price)
type PriceSubscription ¶
type PriceSubscription struct {
// contains filtered or unexported fields
}
PriceSubscription represents a subscription, can be used to free resources
type Trade ¶
type Trade struct { CurrentUnits int32 `json:"currentUnits,string"` Financing float64 `json:"financing,string"` ID string `json:"id"` InitialUnits int32 `json:"initialUnits,string"` Instrument string `json:"instrument"` OpenTime time.Time `json:"openTime"` Price float64 `json:"price,string"` RealizedPL float64 `json:"realizedPL,string"` State string `json:"state"` UnrealizedPL float64 `json:"unrealizedPL,string"` }
type TradeFinancing ¶
type TradeOpened ¶
type TradeReduced ¶
type Transaction ¶
type Transaction struct { AccountBalance float64 `json:"accountBalance,string"` AccountID string `json:"accountID"` Amount float64 `json:"amount,string"` Financing float64 `json:"financing,string"` ID string `json:"id"` Instrument string `json:"instrument"` OrderID string `json:"orderID"` Pl float64 `json:"pl,string"` Price float64 `json:"price,string"` Reason string `json:"reason"` Time time.Time `json:"time"` TradeOpened *TradeOpened `json:"tradeOpened"` TradesClosed []*TradeReduced `json:"tradesClosed"` PositionFinancings []*PositionFinancing `json:"positionFinancings"` Type string `json:"type"` Units string `json:"units"` RejectReason *string `json:"rejectReason"` }
type TransactionHandler ¶
type TransactionHandler func(transaction *Transaction)
type TransactionType ¶
type TransactionType int
const ( OrderFill TransactionType = iota OrderCreate OrderCancel Financing FundsTransfer )
Click to show internal directories.
Click to hide internal directories.