Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateError(key int, a ...interface{}) *mft.Error
- func GenerateErrorE(key int, err error, a ...interface{}) *mft.Error
- func GenerateErrorSubList(key int, sub []*mft.Error, a ...interface{}) *mft.Error
- func Round(price float64, point int) float64
- type Candle
- type Candles
- func (cs Candles) After(date time.Time) (out Candles)
- func (cs Candles) AfterIX(date time.Time) int
- func (cs Candles) Aggregate(aggFrame time.Duration) (out Candles)
- func (cs Candles) Before(date time.Time) (out Candles)
- func (cs Candles) Bounds() (firstDate time.Time, lastDate time.Time, min float64, max float64)
- func (cs Candles) Clone() (res Candles)
- func (cs Candles) FillDividents(ds Dividends) (out Candles)
- func (cs Candles) Len() int
- func (cs Candles) Less(i, j int) bool
- func (cs Candles) Sort()
- func (cs Candles) Swap(i, j int)
- type Command
- type CommandInfo
- type CommandResult
- type Dividend
- type Dividends
- type InstrumentInfo
- type JsonTypedContainer
- type LotPrices
- type MetaForOperations
- type MetaForStep
- type Operation
- type OrderBook
- type RestPriceQuantity
- type StartegyStatus
- type StatusOrder
- type StepParams
- type Strategy
- type TradingStatus
Constants ¶
View Source
const H24 = time.Hour * 24
Variables ¶
View Source
var Errors map[int]string = map[int]string{
500000000: "strategies.TakeProfitBuy: Command: `%v` does not exists",
500000010: "strategies.TakeProfitBuy: Command: `%v` param not set",
500000011: "strategies.TakeProfitBuy: Command: `%v` param `%v` is not float64",
500000020: "strategies.TakeProfitBuy: Command: `%v` param not set",
500000021: "strategies.TakeProfitBuy: Command: `%v` param `%v` is not int",
500000030: "strategies.TakeProfitBuy: Command: `%v` param not set",
500000031: "strategies.TakeProfitBuy: Command: `%v` param `%v` is not bool",
500000100: "strategies.TakeProfitBuy: Step: fail order book get",
500000101: "strategies.TakeProfitBuy: Step: fail buy by price",
500000102: "strategies.TakeProfitBuy: Step: fail get info about buy order",
500000200: "strategies.TakeProfitSell: Command: `%v` does not exists",
500000210: "strategies.TakeProfitSell: Command: `%v` param not set",
500000211: "strategies.TakeProfitSell: Command: `%v` param `%v` is not float64",
500000220: "strategies.TakeProfitSell: Command: `%v` param not set",
500000221: "strategies.TakeProfitSell: Command: `%v` param `%v` is not int",
500000230: "strategies.TakeProfitSell: Command: `%v` param not set",
500000231: "strategies.TakeProfitSell: Command: `%v` param `%v` is not bool",
500000300: "strategies.TakeProfitSell: Step: fail order book get",
500000301: "strategies.TakeProfitSell: Step: fail sell by price",
500000302: "strategies.TakeProfitSell: Step: fail get info about sell order",
500000400: "strategies.WingedSwing: Command: `%v` does not exists",
500000410: "strategies.WingedSwing: Command: `%v` param not set",
500000411: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000412: "strategies.WingedSwing: Command: `%v` param not set",
500000413: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000414: "strategies.WingedSwing: Command: `%v` param not set",
500000415: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000420: "strategies.WingedSwing: Command: `%v` param not set",
500000421: "strategies.WingedSwing: Command: `%v` param `%v` is not int",
500000430: "strategies.WingedSwing: Command: `%v` param not set",
500000431: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000432: "strategies.WingedSwing: Command: `%v` param not set",
500000433: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000500: "strategies.WingedSwing: Step: fail order book get",
500000501: "strategies.WingedSwing: Step: fail buy by price",
500000502: "strategies.WingedSwing: Step: fail get info about buy order",
500000503: "strategies.WingedSwing: Step: fail get info about sell order",
500000504: "strategies.WingedSwing: Step: fail sell by price",
500000505: "strategies.WingedSwing: Step: unexpected situation InMarket: %v",
500000506: "strategies.WingedSwing: Step: unexpected situation InMarket: %v; s.Volume: %v",
500000507: "strategies.WingedSwing: Step: fail cancel sell on prepare to stop loss",
500000508: "strategies.WingedSwing: Step: fail sell by market !!! stop loss",
500000509: "strategies.WingedSwing: Step: fail sell to StopLostBank !!! stop loss",
500000510: "strategies.WingedSwing: Step: fail buy from StopLostBank",
500000511: "strategies.WingedSwing: Step: fail buy from StopLostBank add_place",
500000512: "strategies.WingedSwing: Step: fail cancel buy on buy from stop loss bank",
500000513: "strategies.WingedSwing: Step: fail cancel buy task",
500000514: "strategies.WingedSwing: Step: fail cancel sell task",
500000515: "strategies.WingedSwing: Step: fail send STOP LOSS to StopLostBank",
500000516: "strategies.WingedSwing: Step: fail send REQUEST SALE to StopLostBank",
500000600: "strategies.WingedSwing: Command: `%v` does not exists",
500000610: "strategies.WingedSwing: Command: `%v` param not set",
500000611: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000612: "strategies.WingedSwing: Command: `%v` param not set",
500000613: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000614: "strategies.WingedSwing: Command: `%v` param not set",
500000615: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000616: "strategies.WingedSwing: Command: `%v` param not set",
500000617: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000618: "strategies.WingedSwing: Command: `%v` param not set",
500000619: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000620: "strategies.WingedSwing: Command: `%v` param not set",
500000621: "strategies.WingedSwing: Command: `%v` param `%v` is not int",
500000640: "strategies.WingedSwing: Command: `%v` param `%v` not set",
500000641: "strategies.WingedSwing: Command: `%v` value `%v` is not int (param `%v`)",
500000642: "strategies.WingedSwing: Command: `%v` param `%v` not set",
500000643: "strategies.WingedSwing: Command: `%v` value `%v` is not int (param `%v`)",
500000644: "strategies.WingedSwing: Command: `%v` param `%v` not set",
500000645: "strategies.WingedSwing: Command: `%v` value `%v` is not int (param `%v`)",
500000646: "strategies.WingedSwing: Command: `%v` param `%v` not set",
500000647: "strategies.WingedSwing: Command: `%v` value `%v` is not int (param `%v`)",
500000650: "strategies.WingedSwing: Command: `%v` lavel `i` does not exists",
500000651: "strategies.WingedSwing: Command: `%v` lavel `i` value `%v` is not int (element `%v`)",
500000660: "strategies.WingedSwing: Command: `%v` param not set",
500000661: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000662: "strategies.WingedSwing: Command: `%v` param not set",
500000663: "strategies.WingedSwing: Command: `%v` param `%v` is not float64",
500000700: "strategies.WingedSwing: Step: fail do some nested steps faild: %v of %v",
}
Errors codes and description
Functions ¶
func GenerateErrorE ¶
GenerateErrorE -
func GenerateErrorSubList ¶ added in v0.0.6
GenerateError -
Types ¶
type Candle ¶
type Candle struct { InstrumentId string `json:"instrument_id"` Ticker string `json:"ticker"` // End date Date time.Time `json:"date"` Start time.Time `json:"start"` Open float64 `json:"open"` High float64 `json:"high"` Low float64 `json:"low"` Close float64 `json:"close"` Vol int `json:"vol"` // Last dividend amount LastDividend float64 `json:"last_dividend,omitempty"` // First date after [last dividend buy date] LastDividendDate time.Time `json:"last_dividend_date,omitempty"` // sum of all dividends amount AggDividend float64 `json:"agg_dividend,omitempty"` // Any additional info AdditionalInfo map[string]interface{} `json:"add_info,omitempty"` }
type Candles ¶
type Candles []Candle
func (Candles) FillDividents ¶
type CommandInfo ¶ added in v0.0.9
type CommandResult ¶ added in v0.0.9
type CommandResult struct {
Message string
}
type Dividend ¶
type InstrumentInfo ¶ added in v0.0.6
type JsonTypedContainer ¶
type JsonTypedContainer struct { Type string `json:"type"` Data json.RawMessage `json:"data"` }
type MetaForOperations ¶ added in v0.0.9
type MetaForStep ¶ added in v0.0.9
type MetaForStep struct { IsStopLoss bool HasChanges bool Name string OpDescr []string SubMeta []MetaForStep }
type OrderBook ¶
type OrderBook struct { InstrumentId string `json:"instrument_id"` Ticker string `json:"ticker"` Time time.Time `json:"time"` Depth int `json:"depth"` // under price Bids []RestPriceQuantity `json:"bids"` // over price Asks []RestPriceQuantity `json:"asks"` TradeStatus TradingStatus `json:"trade_status"` MinPriceIncrement float64 `json:"min_price_increment"` LastPrice float64 `json:"last_price,omitempty"` ClosePrice float64 `json:"close_price,omitempty"` LimitUp float64 `json:"limit_up,omitempty"` LimitDown float64 `json:"limit_down,omitempty"` }
type RestPriceQuantity ¶
type StartegyStatus ¶ added in v0.0.6
type StartegyStatus struct {
IsOnline bool `json:"is_online"`
}
type StatusOrder ¶
type StatusOrder string
const ( Complete StatusOrder = "complete" Canceled StatusOrder = "canceled" Unknown StatusOrder = "unknown" Wait StatusOrder = "wait" )
type StepParams ¶
type StepParams interface { GetCandles(instrumentId string, ticker string, dateFrom time.Time, dateTo time.Time) (cs Candles, err *mft.Error) GetOrderBook(instrumentId string, ticker string) (ob *OrderBook, err *mft.Error) GetInstrumentInfo(instrumentId string, ticker string) (instrumentInfo *InstrumentInfo, err *mft.Error) BuyByMarket(instrumentId string, ticker string, cnt int, meta *MetaForOperations) (orderId string, err *mft.Error) SellByMarket(instrumentId string, ticker string, cnt int, meta *MetaForOperations) (orderId string, err *mft.Error) BuyByPrice(instrumentId string, ticker string, cnt int, price float64, meta *MetaForOperations) (orderId string, err *mft.Error) SellByPrice(instrumentId string, ticker string, cnt int, price float64, meta *MetaForOperations) (orderId string, err *mft.Error) CancelBuyOrder(instrumentId string, ticker string, orderId string, meta *MetaForOperations) (ok bool, err *mft.Error) CancelSellOrder(instrumentId string, ticker string, orderId string, meta *MetaForOperations) (ok bool, err *mft.Error) StatusBuyOrder(instrumentId string, ticker string, orderId string, meta *MetaForOperations) (status StatusOrder, prices []LotPrices, err *mft.Error) StatusSellOrder(instrumentId string, ticker string, orderId string, meta *MetaForOperations) (status StatusOrder, prices []LotPrices, err *mft.Error) }
type Strategy ¶
type Strategy interface { Step(p StepParams) (meta MetaForStep, err *mft.Error) Status() StartegyStatus String() string Type() string Json() string Command(cmd Command, params map[string]string) (res CommandResult, ok bool, err *mft.Error) AllowCommands() map[Command]CommandInfo Description() string }
type TradingStatus ¶
type TradingStatus string
const ( BreakInTrading TradingStatus = "break_in_trading" NormalTrading TradingStatus = "normal_trading" NotAvailableForTrading TradingStatus = "not_available_for_trading" ClosingAuction TradingStatus = "closing_auction" ClosingPeriod TradingStatus = "closing_period" DarkPoolAuction TradingStatus = "dark_pool_auction" DiscreteAuction TradingStatus = "discrete_auction" OpeningPeriod TradingStatus = "opening_period" OpeningAuctionPeriod TradingStatus = "opening_auction_period" TradingAtClosingAuctionPrice TradingStatus = "trading_at_closing_auction_price" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.