Documentation ¶
Overview ¶
Package models contains the models for the Moneybots API
Package models contains the models for the Moneybots API ¶
Package models contains the models for the Moneybots API ¶
Package models contains the models for the Moneybots API ¶
Package models contains the models for the Moneybots API
Index ¶
- Constants
- Variables
- type Depth
- type DepthItem
- type IndexModel
- type InstrumentModel
- type LTPData
- type LogLevel
- type OHLC
- type OHLCData
- type QueryInstrumentsParams
- type QuoteData
- type QuoteResponse
- type SessionModel
- type TickerData
- type TickerDataDepth
- type TickerDataDepthItem
- type TickerDataOHLC
- type TickerInstrument
- type TickerLog
Constants ¶
const ( TickerInstrumentsTableName = "ticker_instruments" TickerDataTableName = "ticker_data" TickerLogTableName = "_ticker_logs" )
const SessionsTableName = "sessions"
Variables ¶
var IndexTableName = "indices"
TableName is the name of the table for instruments
var InstrumentsTableName = "instruments"
TableName is the name of the table for instruments
Functions ¶
This section is empty.
Types ¶
type DepthItem ¶
type DepthItem struct { Price float64 `json:"price"` Quantity uint32 `json:"quantity"` Orders uint32 `json:"orders"` }
DepthItem is the depth item for a given instrument
type IndexModel ¶
type IndexModel struct { ID uint32 `gorm:"primaryKey;autoIncrement" json:"-"` Index string `json:"index" gorm:"index"` Exchange string `json:"exchange"` Tradingsymbol string `json:"tradingsymbol" gorm:"index"` CompanyName string `json:"company_name"` Industry string `json:"industry" gorm:"index"` Series string `json:"series"` ISINCode string `json:"isin_code"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"-"` }
Index represents a trading index
func (IndexModel) TableName ¶
func (IndexModel) TableName() string
TableName specifies the table name for the Index model
type InstrumentModel ¶
type InstrumentModel struct { InstrumentToken uint32 `gorm:"primaryKey;uniqueIndex;index" csv:"instrument_token" json:"instrument_token"` ExchangeToken uint32 `csv:"exchange_token" json:"exchange_token"` Tradingsymbol string `` /* 137-byte string literal not displayed */ Name string `gorm:"index:idx_ex_nm_xp,priority:2;" csv:"name" json:"name"` LastPrice float64 `csv:"last_price" json:"last_price"` Expiry string `` /* 126-byte string literal not displayed */ Strike float64 `gorm:"index:idx_ex_ts_xp_st,priority:4" csv:"strike" json:"strike"` TickSize float64 `csv:"tick_size" json:"tick_size"` LotSize uint `csv:"lot_size" json:"lot_size"` InstrumentType string `gorm:"index" csv:"instrument_type" json:"instrument_type"` Segment string `gorm:"index" csv:"segment" json:"segment"` Exchange string `` /* 157-byte string literal not displayed */ UpdatedAt time.Time `gorm:"autoUpdateTime" json:"-"` }
Instrument represents a trading instrument
func (InstrumentModel) TableName ¶
func (InstrumentModel) TableName() string
TableName specifies the table name for the Instrument model
type LTPData ¶
type LTPData struct { InstrumentToken uint32 `json:"-"` LastPrice float64 `json:"last_price"` Timestamp string `json:"timestamp"` UpdatedAt string `json:"-"` }
LTPData is the LTP data for a given instrument
type LogLevel ¶
type LogLevel string
TICKER LOGS ----------------------------------------------------- LogLevel represents the severity of a log message
type OHLC ¶
type OHLC struct { Open float64 `json:"open"` High float64 `json:"high"` Low float64 `json:"low"` Close float64 `json:"close"` }
OHLC is the OHLC data for a given instrument
type OHLCData ¶
type OHLCData struct { InstrumentToken uint32 `json:"-"` LastPrice float64 `json:"last_price"` VolumeTraded uint32 `json:"volume"` AverageTradePrice float64 `json:"average_price"` Timestamp string `json:"timestamp"` LastTradeTime string `json:"last_trade_time"` OHLC OHLC `json:"ohlc"` UpdatedAt string `json:"-"` }
OHLCData is the OHLC data for a given instrument
type QueryInstrumentsParams ¶
type QueryInstrumentsParams struct { Exchange string Tradingsymbol string InstrumentToken string Name string Expiry string Strike string Segment string InstrumentType string }
QueryInstrumentsParams is the parameters for the QueryInstruments endpoint
type QuoteData ¶
type QuoteData struct { Instrument string `json:"instrument"` Mode string `json:"mode"` InstrumentToken uint32 `json:"instrument_token"` IsTradable bool `json:"is_tradable"` IsIndex bool `json:"is_index"` Timestamp string `json:"timestamp"` LastTradeTime string `json:"last_trade_time"` LastPrice float64 `json:"last_price"` LastTradedQuantity uint32 `json:"last_traded_quantity"` TotalBuyQuantity uint32 `json:"total_buy_quantity"` TotalSellQuantity uint32 `json:"total_sell_quantity"` VolumeTraded uint32 `json:"volume"` // TotalBuy uint32 `json:"total_buy"` // TotalSell uint32 `json:"total_sell"` AverageTradePrice float64 `json:"average_price"` OI uint32 `json:"oi"` OIDayHigh uint32 `json:"oi_day_high"` OIDayLow uint32 `json:"oi_day_low"` NetChange float64 `json:"net_change"` OHLC OHLC `json:"ohlc"` Depth Depth `json:"depth"` UpdatedAt string `json:"-"` }
QuoteData is the quote data for a given instrument
type QuoteResponse ¶
type QuoteResponse struct { Status string `json:"status"` Data map[string]interface{} `json:"data"` }
QuoteResponse is the response for the quote API
type SessionModel ¶
type SessionModel struct { UserId string `gorm:"primaryKey;uniqueIndex;index:idx_uid_hpw,priority:1" json:"user_id"` UserName string `json:"user_name"` UserShortname string `json:"user_shortname"` AvatarUrl string `json:"avatar_url"` PublicToken string `json:"public_token"` KfSession string `json:"kf_session"` Enctoken string `gorm:"index" json:"enctoken"` LoginTime string `json:"login_time"` HashedPassword string `gorm:"index:idx_uid_hpw,priority:2" json:"-"` CreatedAt time.Time `gorm:"autoCreateTime" json:"-"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"-"` }
func (SessionModel) TableName ¶
func (SessionModel) TableName() string
type TickerData ¶
type TickerData struct { Instrument string `gorm:"index" json:"instrument"` InstrumentToken uint32 `gorm:"primaryKey" json:"instrument_token"` Mode string `gorm:"type:varchar(10)" json:"mode"` IsTradable bool `json:"is_tradable"` IsIndex bool `json:"is_index"` Timestamp time.Time `json:"timestamp"` LastTradeTime time.Time `json:"last_trade_time"` LastPrice float64 `gorm:"type:decimal(10,2);column:last_price" json:"last_price"` LastTradedQuantity uint32 `gorm:"type:bigint;column:last_traded_quantity" json:"last_traded_quantity"` TotalBuyQuantity uint32 `gorm:"type:bigint;column:total_buy_quantity" json:"total_buy_quantity"` TotalSellQuantity uint32 `gorm:"type:bigint;column:total_sell_quantity" json:"total_sell_quantity"` VolumeTraded uint32 `gorm:"type:bigint;column:volume" json:"volume"` AverageTradePrice float64 `gorm:"type:decimal(10,2);column:average_price" json:"average_price"` OI uint32 `gorm:"type:bigint;column:oi" json:"oi"` OIDayHigh uint32 `gorm:"type:bigint;column:oi_day_high" json:"oi_day_high"` OIDayLow uint32 `gorm:"type:bigint;column:oi_day_low" json:"oi_day_low"` NetChange float64 `gorm:"type:decimal(10,2)" json:"net_change"` OHLC datatypes.JSON `gorm:"type:jsonb;column:ohlc" json:"ohlc"` Depth datatypes.JSON `gorm:"type:jsonb;column:depth" json:"depth"` UpdatedAt time.Time `gorm:"autoUpdateTime:nano" json:"updated_at"` }
TICKER DATA -------------------------------------------------------- TickerData represents the tick data for an instrument
func (*TickerData) GetDepth ¶
func (t *TickerData) GetDepth() (TickerDataDepth, error)
func (*TickerData) GetOHLC ¶
func (t *TickerData) GetOHLC() (TickerDataOHLC, error)
func (TickerData) TableName ¶
func (TickerData) TableName() string
type TickerDataDepth ¶
type TickerDataDepth struct { Buy [5]TickerDataDepthItem `json:"buy"` Sell [5]TickerDataDepthItem `json:"sell"` }
type TickerDataDepthItem ¶
type TickerDataOHLC ¶
type TickerDataOHLC struct { Open float64 `json:"open"` High float64 `json:"high"` Low float64 `json:"low"` Close float64 `json:"close"` }
func (*TickerDataOHLC) Scan ¶
func (o *TickerDataOHLC) Scan(value interface{}) error
type TickerInstrument ¶
type TickerInstrument struct { UserID string `gorm:"uniqueIndex:idx_userId_instrument,priority:1;type:varchar(10)" json:"user_id"` Instrument string `gorm:"uniqueIndex:idx_userId_instrument,priority:2" json:"instrument"` InstrumentToken uint32 `json:"instrument_token"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` }
TICKER INSTRUMENTS ------------------------------------------------- TickerInstrument represents the instruments for which tick data is subscribed
func (TickerInstrument) TableName ¶
func (TickerInstrument) TableName() string