models

package
v0.0.0-...-208694a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AtTheClose        DurationType = "AtTheClose"
	AtTheOpening                   = "AtTheOpening"
	DayOrder                       = "DayOrder"
	FillOrKill                     = "FillOrKill"
	GoodForPeriod                  = "GoodForPeriod"
	GoodTillCancel                 = "GoodTillCancel"
	GoodTillDate                   = "GoodTillDate"
	ImmediateOrCancel              = "ImmediateOrCancel"
	Unknown                        = "Unknown"
)
View Source
const (
	Algorithmic           OrderType = "Algorithmic"
	GuaranteedStop                  = "GuaranteedStop"
	Limit                           = "Limit"
	Market                          = "Market"
	Stop                            = "Stop"
	StopIfBid                       = "StopIfBid"
	StopIfOffered                   = "StopIfOffered"
	StopIfTraded                    = "StopIfTraded"
	StopLimit                       = "StopLimit"
	Switch                          = "Switch"
	TrailingStop                    = "TrailingStop"
	TrailingStopIfBid               = "TrailingStopIfBid"
	TrailingStopIfOffered           = "TrailingStopIfOffered"
	TrailingStopIfTraded            = "TrailingStopIfTraded"
	Traspaso                        = "Traspaso"
	TraspasoIn                      = "TraspasoIn"
)
View Source
const (
	Bond             AssetType = "Bond"
	Cash                       = "Cash"
	CfdIndexOption             = "CfdIndexOption"
	CfdOnFutures               = "CfdOnFutures"
	CfdOnIndex                 = "CfdOnIndex"
	CfdOnStock                 = "CfdOnStock"
	ContractFutures            = "ContractFutures"
	FuturesOption              = "FuturesOption"
	FuturesStrategy            = "FuturesStrategy"
	FxBinaryOption             = "FxBinaryOption"
	FxForwards                 = "FxForwards"
	FxKnockInOption            = "FxKnockInOption"
	FxKnockOutOption           = "FxKnockOutOption"
	FxNoTouchOption            = "FxNoTouchOption"
	FxOneTouchOption           = "FxOneTouchOption"
	FxSpot                     = "FxSpot"
	FxVanillaOption            = "FxVanillaOption"
	IpoOnStock                 = "IpoOnStock"
	ManagedFund                = "ManagedFund"
	MutualFund                 = "MutualFund"
	Stock                      = "Stock"
	StockIndex                 = "StockIndex"
	StockIndexOption           = "StockIndexOption"
	StockOption                = "StockOption"
)

Variables

This section is empty.

Functions

func BusinessRuleViolation

func BusinessRuleViolation(oe *OrderError) bool

func GetBusinessViolations

func GetBusinessViolations() []string

func GetPriceTick

func GetPriceTick(price float64, elements []Elements) float64

func GetStringError

func GetStringError(err error) string

Types

type Accounts

type Accounts struct {
	Data []struct {
		AccountGroupKey                       string   `json:"AccountGroupKey"`
		AccountID                             string   `json:"AccountId"`
		AccountKey                            string   `json:"AccountKey"`
		AccountSubType                        string   `json:"AccountSubType"`
		AccountType                           string   `json:"AccountType"`
		Active                                bool     `json:"Active"`
		CanUseCashPositionsAsMarginCollateral bool     `json:"CanUseCashPositionsAsMarginCollateral"`
		CfdBorrowingCostsActive               bool     `json:"CfdBorrowingCostsActive"`
		ClientID                              string   `json:"ClientId"`
		ClientKey                             string   `json:"ClientKey"`
		CreationDate                          string   `json:"CreationDate"`
		Currency                              string   `json:"Currency"`
		CurrencyDecimals                      int      `json:"CurrencyDecimals"`
		DirectMarketAccess                    bool     `json:"DirectMarketAccess"`
		IndividualMargining                   bool     `json:"IndividualMargining"`
		IsCurrencyConversionAtSettlementTime  bool     `json:"IsCurrencyConversionAtSettlementTime"`
		IsMarginTradingAllowed                bool     `json:"IsMarginTradingAllowed"`
		IsShareable                           bool     `json:"IsShareable"`
		IsTrialAccount                        bool     `json:"IsTrialAccount"`
		LegalAssetTypes                       []string `json:"LegalAssetTypes"`
		MarginCalculationMethod               string   `json:"MarginCalculationMethod"`
		Sharing                               []string `json:"Sharing"`
		SupportsAccountValueProtectionLimit   bool     `json:"SupportsAccountValueProtectionLimit"`
		UseCashPositionsAsMarginCollateral    bool     `json:"UseCashPositionsAsMarginCollateral"`
	} `json:"Data"`
}

func (*Accounts) GetAccountKey

func (a *Accounts) GetAccountKey(idx int) string

func (*Accounts) GetAccountKeyMe

func (a *Accounts) GetAccountKeyMe() string

func (*Accounts) GetClientKey

func (a *Accounts) GetClientKey(idx int) string

func (*Accounts) GetClientKeyMe

func (a *Accounts) GetClientKeyMe() string

type ActiveOrder

type ActiveOrder struct {
	Amount                   int                 `json:"Amount"`
	BuySell                  BuySell             `json:"BuySell"`
	OrderType                OrderType           `json:"OrderType"`
	AccountID                string              `json:"AccountId,omitempty"`
	CalculationReliability   string              `json:"CalculationReliability,omitempty"`
	ClientID                 string              `json:"ClientId,omitempty"`
	ClientKey                string              `json:"ClientKey,omitempty"`
	ClientName               string              `json:"ClientName,omitempty"`
	CorrelationKey           string              `json:"CorrelationKey,omitempty"`
	CurrentPrice             float64             `json:"CurrentPrice,omitempty"`
	CurrentPriceDelayMinutes float64             `json:"CurrentPriceDelayMinutes,omitempty"`
	CurrentPriceType         string              `json:"CurrentPriceType,omitempty"`
	DistanceToMarket         float64             `json:"DistanceToMarket,omitempty"`
	Duration                 *Duration           `json:"Duration,omitempty"`
	Exchange                 *ExchangeOrder      `json:"Exchange,omitempty"`
	IsForceOpen              bool                `json:"IsForceOpen,omitempty"`
	Isin                     string              `json:"Isin,omitempty"`
	IsMarketOpen             bool                `json:"IsMarketOpen,omitempty"`
	MarketPrice              float64             `json:"MarketPrice,omitempty"`
	MarketValue              float64             `json:"MarketValue,omitempty"`
	NonTradableReason        string              `json:"NonTradableReason,omitempty"`
	OpenOrderType            string              `json:"OpenOrderType,omitempty"`
	OrderAmountType          string              `json:"OrderAmountType,omitempty"`
	OrderID                  string              `json:"OrderId,omitempty"`
	OrderRelation            string              `json:"OrderRelation,omitempty"`
	OrderTime                string              `json:"OrderTime,omitempty"`
	Price                    float64             `json:"Price,omitempty"`
	RelatedOpenOrders        []RelatedOpenOrders `json:"RelatedOpenOrders,omitempty"`
	RelatedPositionID        string              `json:"RelatedPositionId,omitempty"`
	Status                   string              `json:"Status,omitempty"`
	TradingStatus            string              `json:"TradingStatus,omitempty"`
	Uic                      int32               `json:"Uic"`
}

ActiveOrder Is used on the GET Orders Endpoints (EX. List/Getting an Order)

type AssetType

type AssetType string

type Balance

type Balance struct {
	CalculationReliability string  `json:"CalculationReliability"`
	CashBalance            float64 `json:"CashBalance"`
	ChangesScheduled       bool    `json:"ChangesScheduled"`
	ClosedPositionsCount   float64 `json:"ClosedPositionsCount"`
	CollateralAvailable    float64 `json:"CollateralAvailable"`
	CollateralCreditValue  struct {
		Line           float64 `json:"Line"`
		UtilizationPct float64 `json:"UtilizationPct"`
	} `json:"CollateralCreditValue"`
	CostToClosePositions float64 `json:"CostToClosePositions"`
	Currency             string  `json:"Currency"`
	CurrencyDecimals     float64 `json:"CurrencyDecimals"`
	InitialMargin        struct {
		CollateralAvailable   float64 `json:"CollateralAvailable"`
		CollateralCreditValue struct {
			Line           float64 `json:"Line"`
			UtilizationPct float64 `json:"UtilizationPct"`
		} `json:"CollateralCreditValue"`
		MarginAvailable              float64 `json:"MarginAvailable"`
		MarginCollateralNotAvailable float64 `json:"MarginCollateralNotAvailable"`
		MarginUsedByCurrentPositions float64 `json:"MarginUsedByCurrentPositions"`
		MarginUtilizationPct         float64 `json:"MarginUtilizationPct"`
		NetEquityForMargin           float64 `json:"NetEquityForMargin"`
	} `json:"InitialMargin"`
	IsPortfolioMarginModelSimple     bool    `json:"IsPortfolioMarginModelSimple"`
	MarginAvailableForTrading        float64 `json:"MarginAvailableForTrading"`
	MarginCollateralNotAvailable     float64 `json:"MarginCollateralNotAvailable"`
	MarginExposureCoveragePct        float64 `json:"MarginExposureCoveragePct"`
	MarginNetExposure                float64 `json:"MarginNetExposure"`
	MarginUsedByCurrentPositions     float64 `json:"MarginUsedByCurrentPositions"`
	MarginUtilizationPct             float64 `json:"MarginUtilizationPct"`
	NetEquityForMargin               float64 `json:"NetEquityForMargin"`
	NetPositionsCount                float64 `json:"NetPositionsCount"`
	NonMarginPositionsValue          float64 `json:"NonMarginPositionsValue"`
	OpenPositionsCount               float64 `json:"OpenPositionsCount"`
	OptionPremiumsMarketValue        float64 `json:"OptionPremiumsMarketValue"`
	OrdersCount                      float64 `json:"OrdersCount"`
	OtherCollateral                  float64 `json:"OtherCollateral"`
	SettlementValue                  float64 `json:"SettlementValue"`
	TotalValue                       float64 `json:"TotalValue"`
	TransactionsNotBooked            float64 `json:"TransactionsNotBooked"`
	UnrealizedMarginClosedProfitLoss float64 `json:"UnrealizedMarginClosedProfitLoss"`
	UnrealizedMarginOpenProfitLoss   float64 `json:"UnrealizedMarginOpenProfitLoss"`
	UnrealizedMarginProfitLoss       float64 `json:"UnrealizedMarginProfitLoss"`
	UnrealizedPositionsValue         float64 `json:"UnrealizedPositionsValue"`
}

type BuySell

type BuySell string
const (
	Buy  BuySell = "Buy"
	Sell         = "Sell"
)

type Duration

type Duration struct {
	DurationType DurationType `json:"DurationType"`
}

type DurationType

type DurationType string

type Elements

type Elements struct {
	HighPrice float64 `json:"HighPrice"`
	TickSize  float64 `json:"TickSize"`
}

type ErrorInfo

type ErrorInfo struct {
	ErrorCode string `json:"ErrorCode"`
	Message   string `json:"Message"`
}

type Exchange

type Exchange struct {
	AllDay               bool               `json:"AllDay"`
	CountryCode          string             `json:"CountryCode"`
	Currency             string             `json:"Currency"`
	ExchangeID           string             `json:"ExchangeId"`
	ExchangeSessions     []ExchangeSessions `json:"ExchangeSessions"`
	Mic                  string             `json:"Mic"`
	Name                 string             `json:"Name"`
	PriceSourceName      string             `json:"PriceSourceName,omitempty"`
	TimeZoneID           string             `json:"TimeZoneId"`
	TimeZone             int                `json:"TimeZone"`
	TimeZoneAbbreviation string             `json:"TimeZoneAbbreviation"`
	TimeZoneOffset       string             `json:"TimeZoneOffset"`

	// Internal use
	IsOpen bool `json:",omitempty"`
}

type ExchangeOrder

type ExchangeOrder struct {
	Description string `json:"Description"`
	ExchangeID  string `json:"ExchangeId"`
	IsOpen      bool   `json:"IsOpen"`
}

type ExchangeSessions

type ExchangeSessions struct {
	EndTime   string `json:"EndTime"`
	StartTime string `json:"StartTime"`
	State     string `json:"State"`
}

type Format

type Format struct {
	Decimals      int `json:"Decimals"`
	OrderDecimals int `json:"OrderDecimals"`
}

type InfoPrice

type InfoPrice struct {
	AssetType   string `json:"AssetType"`
	LastUpdated string `json:"LastUpdated"`
	PriceSource string `json:"PriceSource"`
	Quote       Quote  `json:"Quote"`
	Uic         int    `json:"Uic"`
}

type Instrument

type Instrument interface {
	GetSymbol() string
	GetSymbolSimple() string
	GetExchangeID() string
	GetID() int32
	GetAssetType() AssetType
	GetOrder() *Order
}

type InstrumentDetails

type InstrumentDetails interface {
	Instrument
	CalculatePriceWithThickSize(price float64, percentage float64) float64
	GetDecimals() int
	GetMinimumTradeSize() int
	GetMinimumOrderValue() int
}

type InstrumentPrice

type InstrumentPrice struct {
	AssetType   string `json:"AssetType"`
	LastUpdated string `json:"LastUpdated"`
	PriceSource string `json:"PriceSource"`
	Quote       Quote  `json:"Quote"`
	Uic         int    `json:"Uic"`
}

type ListExchanges

type ListExchanges struct {
	Count int        `json:"__count"`
	Data  []Exchange `json:"Data"`
}

type ModeledAPI

type ModeledAPI struct {
	Ctx    context.Context
	Client *saxo_openapi.APIClient
	// contains filtered or unexported fields
}

func NewModeledAPI

func NewModeledAPI(ctx context.Context, client *saxo_openapi.APIClient) *ModeledAPI

func (*ModeledAPI) CreatePriceStream

func (ma *ModeledAPI) CreatePriceStream(i Instrument) (chan *QuoteStream, *websocket.Conn, error)

func (*ModeledAPI) GetAccounts

func (ma *ModeledAPI) GetAccounts() (*Accounts, error)

func (*ModeledAPI) GetBalanceMe

func (ma *ModeledAPI) GetBalanceMe() (*Balance, error)

func (*ModeledAPI) GetExchange

func (ma *ModeledAPI) GetExchange(id string) (*Exchange, error)

func (*ModeledAPI) GetInfoPrice

func (ma *ModeledAPI) GetInfoPrice(i Instrument) (*InfoPrice, error)

func (*ModeledAPI) GetInstrument

func (ma *ModeledAPI) GetInstrument(symbol string) (Instrument, error)

func (*ModeledAPI) GetInstrumentDetails

func (ma *ModeledAPI) GetInstrumentDetails(i Instrument) (InstrumentDetails, error)

func (*ModeledAPI) GetInstrumentPrice

func (ma *ModeledAPI) GetInstrumentPrice(i Instrument) (float64, error)

func (*ModeledAPI) GetOrdersMe

func (ma *ModeledAPI) GetOrdersMe() (*OrderList, error)

func (*ModeledAPI) GetPositionsMe

func (ma *ModeledAPI) GetPositionsMe() (*PositionList, error)

func (*ModeledAPI) Order

func (ma *ModeledAPI) Order(o *Order) (*OrderResponse, error)

func (*ModeledAPI) PreOrder

func (ma *ModeledAPI) PreOrder(o *Order) (*PreOrderResponse, error)

func (*ModeledAPI) Throttle

func (ma *ModeledAPI) Throttle()

func (*ModeledAPI) UpdateLastCall

func (ma *ModeledAPI) UpdateLastCall()

type Order

type Order struct {
	AccountKey                   string    `json:"AccountKey"`
	Amount                       int       `json:"Amount"`
	BuySell                      BuySell   `json:"BuySell"`
	OrderType                    OrderType `json:"OrderType"`
	ManualOrder                  bool      `json:"ManualOrder"`
	Uic                          int32     `json:"Uic"`
	AssetType                    AssetType `json:"AssetType"`
	OrderDuration                Duration  `json:"OrderDuration"`
	Orders                       []Order   `json:"Orders"`
	OrderPrice                   float64   `json:"OrderPrice,omitempty"`
	StopLimitPrice               float64   `json:"StopLimitPrice,omitempty"`
	TrailingStopDistanceToMarket float64   `json:"TrailingStopDistanceToMarket,omitempty"`
	TrailingStopStep             float64   `json:"TrailingStopStep,omitempty"`

	// Internal fields
	GoodToGo       bool    `json:"-"`
	EstimatedPrice float64 `json:"-"`
}

Order is used on POST Orders Endpoints (EX. Placing an Order)

func (*Order) WithAmount

func (o *Order) WithAmount(amount int) *Order

func (*Order) WithBuySell

func (o *Order) WithBuySell(buySell BuySell) *Order

func (*Order) WithDuration

func (o *Order) WithDuration(duration DurationType) *Order

func (*Order) WithPrice

func (o *Order) WithPrice(price float64) *Order

func (*Order) WithStopLimitPrice

func (o *Order) WithStopLimitPrice(stopLimitPrice float64) *Order

func (*Order) WithStopLoss

func (o *Order) WithStopLoss(sellingPrice float64) *Order

func (*Order) WithStopLossStopLimit

func (o *Order) WithStopLossStopLimit(sellingPrice, stopLimitPrice float64) *Order

func (*Order) WithStopLossTrailingStop

func (o *Order) WithStopLossTrailingStop(sellingPrice, distanceToMarket, step float64) *Order

func (*Order) WithTakeProfit

func (o *Order) WithTakeProfit(sellingPrice float64) *Order

func (*Order) WithType

func (o *Order) WithType(orderType OrderType) *Order

type OrderDistances

type OrderDistances struct {
	EntryDefaultDistance          float64 `json:"EntryDefaultDistance"`
	EntryDefaultDistanceType      string  `json:"EntryDefaultDistanceType"`
	StopLimitDefaultDistance      int     `json:"StopLimitDefaultDistance"`
	StopLimitDefaultDistanceType  string  `json:"StopLimitDefaultDistanceType"`
	StopLossDefaultDistance       float64 `json:"StopLossDefaultDistance"`
	StopLossDefaultDistanceType   string  `json:"StopLossDefaultDistanceType"`
	StopLossDefaultEnabled        bool    `json:"StopLossDefaultEnabled"`
	StopLossDefaultOrderType      string  `json:"StopLossDefaultOrderType"`
	TakeProfitDefaultDistance     float64 `json:"TakeProfitDefaultDistance"`
	TakeProfitDefaultDistanceType string  `json:"TakeProfitDefaultDistanceType"`
	TakeProfitDefaultEnabled      bool    `json:"TakeProfitDefaultEnabled"`
}

type OrderError

type OrderError struct {
	ErrorCode  string            `json:"ErrorCode"`
	Message    string            `json:"Message"`
	ModelState map[string]string `json:"ModelState"`
	ErrorInfo  ErrorInfo         `json:"ErrorInfo"`
	Orders     []struct {
		ErrorInfo ErrorInfo `json:"ErrorInfo"`
	} `json:"Orders"`
}

func GetOrderError

func GetOrderError(err error) *OrderError

type OrderList

type OrderList struct {
	Count int           `json:"__count"`
	Data  []ActiveOrder `json:"Data"`
}

type OrderResponse

type OrderResponse struct {
	OrderID    string           `json:"OrderId"`
	TotalPrice float64          `json:"-"`
	Orders     []*OrderResponse `json:"Orders"`
	ErrorInfo  *struct {
		ErrorCode string `json:"ErrorCode,omitempty"`
		Message   string `json:"Message,omitempty"`
	} `json:"ErrorInfo,omitempty"`
}

type OrderType

type OrderType string

type PositionBase

type PositionBase struct {
	AccountID                  string              `json:"AccountId"`
	AccountKey                 string              `json:"AccountKey"`
	Amount                     int                 `json:"Amount"`
	AssetType                  string              `json:"AssetType"`
	CanBeClosed                bool                `json:"CanBeClosed"`
	ClientID                   string              `json:"ClientId"`
	CloseConversionRateSettled bool                `json:"CloseConversionRateSettled"`
	CorrelationKey             string              `json:"CorrelationKey"`
	ExecutionTimeOpen          string              `json:"ExecutionTimeOpen"`
	IsForceOpen                bool                `json:"IsForceOpen"`
	IsMarketOpen               bool                `json:"IsMarketOpen"`
	OpenPrice                  float64             `json:"OpenPrice"`
	RelatedOpenOrders          []RelatedOpenOrders `json:"RelatedOpenOrders"`
	SourceOrderID              string              `json:"SourceOrderId"`
	Status                     string              `json:"Status"`
	Uic                        int                 `json:"Uic"`
	ValueDate                  string              `json:"ValueDate"`
}

type PositionData

type PositionData struct {
	NetPositionID string       `json:"NetPositionId"`
	PositionBase  PositionBase `json:"PositionBase"`
	PositionID    string       `json:"PositionId"`
	PositionView  PositionView `json:"PositionView"`
}

type PositionList

type PositionList struct {
	Count int            `json:"__count"`
	Data  []PositionData `json:"Data"`
}

type PositionView

type PositionView struct {
	CalculationReliability          string  `json:"CalculationReliability"`
	CurrentPrice                    int     `json:"CurrentPrice"`
	CurrentPriceDelayMinutes        int     `json:"CurrentPriceDelayMinutes"`
	CurrentPriceType                string  `json:"CurrentPriceType"`
	Exposure                        int     `json:"Exposure"`
	ExposureCurrency                string  `json:"ExposureCurrency"`
	ExposureInBaseCurrency          int     `json:"ExposureInBaseCurrency"`
	InstrumentPriceDayPercentChange int     `json:"InstrumentPriceDayPercentChange"`
	MarketValue                     int     `json:"MarketValue"`
	ProfitLossOnTrade               float64 `json:"ProfitLossOnTrade"`
	ProfitLossOnTradeInBaseCurrency float64 `json:"ProfitLossOnTradeInBaseCurrency"`
	TradeCostsTotal                 int     `json:"TradeCostsTotal"`
	TradeCostsTotalInBaseCurrency   int     `json:"TradeCostsTotalInBaseCurrency"`
}

type PreOrderResponse

type PreOrderResponse struct {
	EstimatedCashRequired             float64   `json:"EstimatedCashRequired"`
	EstimatedCashRequiredCurrency     string    `json:"EstimatedCashRequiredCurrency"`
	InstrumentToAccountConversionRate float64   `json:"InstrumentToAccountConversionRate"`
	PreCheckResult                    string    `json:"PreCheckResult"`
	ErrorInfo                         ErrorInfo `json:"ErrorInfo"`
}

type PriceRequestArguments

type PriceRequestArguments struct {
	Uic       int32  `json:"Uic"`
	AssetType string `json:"AssetType"`
}

type PriceSnapshot

type PriceSnapshot struct {
	AssetType   string `json:"AssetType"`
	LastUpdated string `json:"LastUpdated"`
	PriceSource string `json:"PriceSource"`
	Quote       Quote  `json:"Quote"`
	Uic         int    `json:"Uic"`
}

type PriceStreamRequest

type PriceStreamRequest struct {
	Arguments   PriceRequestArguments `json:"Arguments"`
	ContextID   string                `json:"ContextId"`
	ReferenceID string                `json:"ReferenceId"`
}

type PriceStreamResponse

type PriceStreamResponse struct {
	ContextID         string        `json:"ContextId"`
	Format            string        `json:"Format"`
	InactivityTimeout int           `json:"InactivityTimeout"`
	ReferenceID       string        `json:"ReferenceId"`
	RefreshRate       int           `json:"RefreshRate"`
	Snapshot          PriceSnapshot `json:"Snapshot"`
	State             string        `json:"State"`
}

type Quote

type Quote struct {
	Amount           int     `json:"Amount"`
	Ask              float64 `json:"Ask"`
	Bid              float64 `json:"Bid"`
	DelayedByMinutes int     `json:"DelayedByMinutes"`
	ErrorCode        string  `json:"ErrorCode"`
	MarketState      string  `json:"MarketState,omitempty"`
	Mid              float64 `json:"Mid"`
	PriceSource      string  `json:"PriceSource"`
	PriceSourceType  string  `json:"PriceSourceType"`
	PriceTypeAsk     string  `json:"PriceTypeAsk"`
	PriceTypeBid     string  `json:"PriceTypeBid"`
	RFQState         string  `json:"RFQState,omitempty"`
}

type QuoteStream

type QuoteStream struct {
	LastUpdated time.Time `json:"LastUpdated"`
	Quote       struct {
		Ask float64 `json:"Ask"`
		Bid float64 `json:"Bid"`
		Mid float64 `json:"Mid"`
	} `json:"Quote"`
}

type RelatedInstruments

type RelatedInstruments struct {
	AssetType string `json:"AssetType"`
	Uic       int    `json:"Uic"`
}

type RelatedOpenOrders

type RelatedOpenOrders struct {
	Amount                       int      `json:"Amount"`
	Duration                     Duration `json:"Duration"`
	OpenOrderType                string   `json:"OpenOrderType"`
	OrderID                      string   `json:"OrderId"`
	OrderPrice                   float64  `json:"OrderPrice"`
	Status                       string   `json:"Status"`
	TrailingStopDistanceToMarket float64  `json:"TrailingStopDistanceToMarket"`
	TrailingStopStep             float64  `json:"TrailingStopStep"`
}

type SaxoInstrument

type SaxoInstrument struct {
	AssetType      AssetType `json:"AssetType"`
	CurrencyCode   string    `json:"CurrencyCode"`
	Description    string    `json:"Description"`
	ExchangeID     string    `json:"ExchangeId"`
	GroupID        int       `json:"GroupId"`
	Identifier     int32     `json:"Identifier"`
	IssuerCountry  string    `json:"IssuerCountry"`
	PrimaryListing int       `json:"PrimaryListing"`
	SummaryType    string    `json:"SummaryType"`
	Symbol         string    `json:"Symbol"`
	TradableAs     []string  `json:"TradableAs"`
}

func (*SaxoInstrument) GetAssetType

func (i *SaxoInstrument) GetAssetType() AssetType

func (*SaxoInstrument) GetExchangeID

func (i *SaxoInstrument) GetExchangeID() string

func (*SaxoInstrument) GetID

func (i *SaxoInstrument) GetID() int32

func (*SaxoInstrument) GetOrder

func (i *SaxoInstrument) GetOrder() *Order

func (*SaxoInstrument) GetSymbol

func (i *SaxoInstrument) GetSymbol() string

func (*SaxoInstrument) GetSymbolSimple

func (i *SaxoInstrument) GetSymbolSimple() string

type SaxoInstrumentDetails

type SaxoInstrumentDetails struct {
	AmountDecimals        int                  `json:"AmountDecimals"`
	AssetType             AssetType            `json:"AssetType"`
	CurrencyCode          string               `json:"CurrencyCode"`
	DefaultAmount         int                  `json:"DefaultAmount"`
	DefaultSlippage       int                  `json:"DefaultSlippage"`
	DefaultSlippageType   string               `json:"DefaultSlippageType"`
	Description           string               `json:"Description"`
	Exchange              Exchange             `json:"Exchange"`
	Format                Format               `json:"Format"`
	GroupID               int                  `json:"GroupId"`
	IncrementSize         int                  `json:"IncrementSize"`
	IsBarrierEqualsStrike bool                 `json:"IsBarrierEqualsStrike"`
	IsComplex             bool                 `json:"IsComplex"`
	IsTradable            bool                 `json:"IsTradable"`
	LotSizeType           string               `json:"LotSizeType"`
	MinimumOrderValue     int                  `json:"MinimumOrderValue"`
	MinimumTradeSize      int                  `json:"MinimumTradeSize"`
	OrderDistances        OrderDistances       `json:"OrderDistances"`
	PriceCurrency         string               `json:"PriceCurrency"`
	PriceToContractFactor int                  `json:"PriceToContractFactor"`
	PrimaryListing        int                  `json:"PrimaryListing"`
	RelatedInstruments    []RelatedInstruments `json:"RelatedInstruments"`
	StandardAmounts       []int                `json:"StandardAmounts"`
	SupportedOrderTypes   []string             `json:"SupportedOrderTypes"`
	Symbol                string               `json:"Symbol"`
	TickSizeScheme        TickSizeScheme       `json:"TickSizeScheme"`
	TradableAs            []string             `json:"TradableAs"`
	TradableOn            []string             `json:"TradableOn"`
	TradingSignals        string               `json:"TradingSignals"`
	TurboDirection        string               `json:"TurboDirection"`
	Uic                   int32                `json:"Uic"`
}

func (*SaxoInstrumentDetails) CalculatePriceWithThickSize

func (id *SaxoInstrumentDetails) CalculatePriceWithThickSize(price float64, percentage float64) float64

func (*SaxoInstrumentDetails) GetAssetType

func (i *SaxoInstrumentDetails) GetAssetType() AssetType

func (*SaxoInstrumentDetails) GetDecimals

func (id *SaxoInstrumentDetails) GetDecimals() int

func (*SaxoInstrumentDetails) GetExchangeID

func (i *SaxoInstrumentDetails) GetExchangeID() string

func (*SaxoInstrumentDetails) GetID

func (i *SaxoInstrumentDetails) GetID() int32

func (*SaxoInstrumentDetails) GetMinimumOrderValue

func (id *SaxoInstrumentDetails) GetMinimumOrderValue() int

func (*SaxoInstrumentDetails) GetMinimumTradeSize

func (id *SaxoInstrumentDetails) GetMinimumTradeSize() int

func (*SaxoInstrumentDetails) GetOrder

func (i *SaxoInstrumentDetails) GetOrder() *Order

func (*SaxoInstrumentDetails) GetSymbol

func (i *SaxoInstrumentDetails) GetSymbol() string

func (*SaxoInstrumentDetails) GetSymbolSimple

func (i *SaxoInstrumentDetails) GetSymbolSimple() string

type SaxoInstruments

type SaxoInstruments struct {
	Data []Instrument `json:"Data"`
}

type TickSizeScheme

type TickSizeScheme struct {
	DefaultTickSize float64    `json:"DefaultTickSize"`
	Elements        []Elements `json:"Elements"`
}

type WSMessage

type WSMessage struct {
	MsgID uint64

	RIDSize       uint8
	RID           []byte
	PayloadFormat uint8
	PayloadSize   uint32
	Payload       []byte
	// contains filtered or unexported fields
}

func NewWSMessage

func NewWSMessage(data []byte) (*WSMessage, error)

func (*WSMessage) Parse

func (w *WSMessage) Parse(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL