Documentation
¶
Index ¶
- Constants
- func ComputeBase64Hmac256(strMessage string, strSecret string) string
- func ComputeHmac1(strMessage string, strSecret string) string
- func ComputeHmac256(strMessage string, strSecret string) string
- func ComputeHmac256Base64(strMessage string, strSecret string) string
- func ComputeHmac256NoDecode(strMessage string, strSecret string) string
- func ComputeHmac256URL(strMessage string, strSecret string) string
- func ComputeHmac512(strMessage string, strSecret string) string
- func ComputeHmac512NoDecode(strMessage string, strSecret string) string
- func ComputeHmacMd5(strMessage string, strSecret string) string
- func ComputeMD5(strMessage string) string
- func GetExternalIP() string
- func HttpGetRequest(strUrl string, mapParams map[string]string) string
- func HttpPostRequest(strUrl string, mapParams map[string]string) string
- func Map2UrlQuery(mapParams map[string]string) string
- func Map2UrlQueryInterface(mapParams map[string]interface{}) string
- func Map2UrlQueryUrl(mapParams map[string]string) string
- type AccountOperation
- type AssetBalance
- type BinancePositions
- type ChainType
- type ChainTypeRequest
- type CoinConstraint
- type Config
- type ConstrainFetchMethod
- type ContractAction
- type ContractTransDir
- type DataSource
- type DepositAddr
- type Exchange
- type ExchangeManager
- func (e *ExchangeManager) Add(exchange Exchange)
- func (e *ExchangeManager) Get(name ExchangeName) Exchange
- func (e *ExchangeManager) GetById(i int) Exchange
- func (e *ExchangeManager) GetExchanges() []Exchange
- func (e *ExchangeManager) GetID(name ExchangeName) int
- func (e *ExchangeManager) GetStr(name string) Exchange
- func (e *ExchangeManager) GetSupportExchanges() []ExchangeName
- func (e *ExchangeManager) Quantity() int
- func (e *ExchangeManager) SubsetPairs(e1, e2 Exchange) []*pair.Pair
- func (e *ExchangeManager) UpdateExData(conf *Update)
- type ExchangeName
- type FutureStats
- type KlineDetail
- type Maker
- type Margin
- type MarginAction
- type MarginBalance
- type MarginOrder
- type OffSetType
- type OpenPositions
- type OperationType
- type Order
- type OrderPriceType
- type OrderStatus
- type OrderTradeType
- type OrderType
- type PairConstraint
- type PublicOperation
- type SubAccountInfo
- type TickerPriceDetail
- type TradeDetail
- type TradeDirection
- type TransferHistory
- type TransferType
- type Update
- type UpdateMethod
- type WDHistory
- type WalletType
Constants ¶
View Source
const ( MAINNET ChainType = "MAINNET" BEP2 ChainType = "BEP2" //TODO // ERC20 ChainType = "ERC20" NEP5 ChainType = "NEP5" //NEO // OMNI ChainType = "OMNI" TRC20 ChainType = "TRC20" BNB ChainType = "BNB" // CET ChainType = "CET" // NXT ChainType = "NXT" // OTHER ChainType = "OTHER" EXCHANGE_API DataSource = "EXCHANGE_API" WEBSOCKET DataSource = "WEBSOCKET" MICROSERVICE_API DataSource = "MICROSERVICE_API" JSON_FILE DataSource = "JSON_FILE" PSQL DataSource = "PSQL" TRANSFER_IN MarginAction = "TRANSFER_IN" TRANSFER_OUT MarginAction = "TRANSFER_OUT" LOAN_REQUEST MarginAction = "LOAN_REQUEST" LOAN_REPAY MarginAction = "LOAN_REPAY" ORDER_STATUS MarginAction = "ORDER_STATUS" BALANCE MarginAction = "BALANCE" LIMIT_BUY MarginAction = "LIMIT_BUY" LIMIT_SELL MarginAction = "LIMIT_SELL" MARKET_BUY MarginAction = "MARKET_BUY" MARKET_SELL MarginAction = "MARKET_SELL" // ************ from goredmergin ************ CONTRACT_MARKET_BUY ContractAction = "CONTRACT_MARKET_BUY" CONTRACT_MARKET_SELL ContractAction = "CONTRACT_MARKET_SELL" CONTRACT_LIMIT_BUY ContractAction = "CONTRACT_LIMIT_BUY" CONTRACT_LIMIT_SELL ContractAction = "CONTRACT_LIMIT_SELL" GET_ADDR ContractAction = "GET_ADDR" LIQUIDATION ContractAction = "LIQUIDATION" CONTRACT_TRANSFER ContractAction = "CONTRACT_TRANSFER" CONTRACT_ORDER_STATUS ContractAction = "CONTRACT_ORDER_STATUS" CONTRACT_BALANCE ContractAction = "CONTRACT_BALANCE" OPEN OffSetType = "open" CLOSE OffSetType = "close" // Huobi, Bitmex Contract LIMIT OrderPriceType = "limit" OPTIMAL_5_FOK OrderPriceType = "optimal_5_fok" OPTIMAL_5 OrderPriceType = "optimal_5" OPTIMAL_10 OrderPriceType = "optimal_10" OPTIMAL_20 OrderPriceType = "optimal_20" OPTIMAL_20_FOK OrderPriceType = "optimal_20_fok" BBO OrderPriceType = "opponent" BBO_FOK OrderPriceType = "opponent_fok" FUTURE_TO_SPOT ContractTransDir = "futures-to-pro" SPOT_TO_FUTURE ContractTransDir = "pro-to-futures" // Binance Contract GTC OrderPriceType = "GTC" IOC OrderPriceType = "IOC" FOK OrderPriceType = "FOK" GTX OrderPriceType = "GTX" API_TIGGER UpdateMethod = "API_TIGGER" TIME_TIGGER UpdateMethod = "TIME_TIGGER" ABCC ExchangeName = "ABCC" BCEX ExchangeName = "BCEX" BELFRIES ExchangeName = "BELFRIES" BGOGO ExchangeName = "BGOGO" BIBOX ExchangeName = "BIBOX" BIGONE ExchangeName = "BIGONE" BIKI ExchangeName = "BIKI" BINANCE ExchangeName = "BINANCE" BINANCEDEX ExchangeName = "BINANCEDEX" BITATM ExchangeName = "BITATM" BITBAY ExchangeName = "BITBAY" BITBNS ExchangeName = "BITBNS" BITCOIN ExchangeName = "BITCOIN" BITFINEX ExchangeName = "BITFINEX" BITFOREX ExchangeName = "BITFOREX" BITHUMB ExchangeName = "BITHUMB" BITMART ExchangeName = "BITMART" BITMAX ExchangeName = "BITMAX" BITMEX ExchangeName = "BITMEX" BITPIE ExchangeName = "BITPIE" BITSTAMP ExchangeName = "BITSTAMP" BITTREX ExchangeName = "BITTREX" BITLISH ExchangeName = "BITLISH" BITRUE ExchangeName = "BITRUE" BITZ ExchangeName = "BITZ" BKEX ExchangeName = "BKEX" BTSE ExchangeName = "BTSE" BYBIT ExchangeName = "BYBIT" BW ExchangeName = "BW" BLANK ExchangeName = "BLANK" BLEUTRADE ExchangeName = "BLEUTRADE" BLOCKTRADE ExchangeName = "BLOCKTRADE" COINALL ExchangeName = "COINALL" COINMEX ExchangeName = "COINMEX" COINBASE ExchangeName = "COINBASE" COINBENE ExchangeName = "COINBENE" COINEAL ExchangeName = "COINEAL" COINEX ExchangeName = "COINEX" COINSUPER ExchangeName = "COINSUPER" COINTIGER ExchangeName = "COINTIGER" COINDEAL ExchangeName = "COINDEAL" CRYPTOPIA ExchangeName = "CRYPTOPIA" DCOIN ExchangeName = "DCOIN" DERIBIT ExchangeName = "DERIBIT" DIGIFINEX ExchangeName = "DIGIFINEX" DRAGONEX ExchangeName = "DRAGONEX" EXMO ExchangeName = "EXMO" EXX ExchangeName = "EXX" FATBTC ExchangeName = "FATBTC" FCOIN ExchangeName = "FCOIN" FTX ExchangeName = "FTX" GATEIO ExchangeName = "GATEIO" GEMINI ExchangeName = "GEMINI" GOKO ExchangeName = "GOKO" GRAVIEX ExchangeName = "GRAVIEX" HITBTC ExchangeName = "HITBTC" HIBITEX ExchangeName = "HIBITEX" HOMIEX ExchangeName = "HOMIEX" HOO ExchangeName = "HOO" HOTBIT ExchangeName = "HOTBIT" HUOBI ExchangeName = "HUOBI" HUOBIDM ExchangeName = "HUOBIDM" HUOBIOTC ExchangeName = "HUOBIOTC" IBANKDIGITAL ExchangeName = "IBANKDIGITAL" IDAX ExchangeName = "IDAX" IDEX ExchangeName = "IDEX" IDCM ExchangeName = "IDCM" KRAKEN ExchangeName = "KRAKEN" KUCOIN ExchangeName = "KUCOIN" LATOKEN ExchangeName = "LATOKEN" LBANK ExchangeName = "LBANK" LIQUID ExchangeName = "LIQUID" LIVECOIN ExchangeName = "LIVECOIN" MXC ExchangeName = "MXC" NEWCAPITAL ExchangeName = "NEWCAPITAL" NICEHASH ExchangeName = "NICEHASH" OKEX ExchangeName = "OKEX" OKEXDM ExchangeName = "OKEXDM" OKSIM ExchangeName = "OKSIM" OTCBTC ExchangeName = "OTCBTC" P2PB2B ExchangeName = "P2PB2B" POLONIEX ExchangeName = "POLONIEX" PROBIT ExchangeName = "PROBIT" RIGHTBTC ExchangeName = "RIGHTBTC" STEX ExchangeName = "STEX" SWITCHEO ExchangeName = "SWITCHEO" TAGZ ExchangeName = "TAGZ" TOKOK ExchangeName = "TOKOK" TIDEX ExchangeName = "TIDEX" TOPBTC ExchangeName = "TOPBTC" TRADEOGRE ExchangeName = "TRADEOGRE" TRADESATOSHI ExchangeName = "TRADESATOSHI" TXBIT ExchangeName = "TXBIT" UEX ExchangeName = "UEX" VIRGOCX ExchangeName = "VIRGOCX" ZBEX ExchangeName = "ZBEX" ZEBITEX ExchangeName = "ZEBITEX" )
View Source
const ( Buy TradeDirection = "b" Sell TradeDirection = "s" BUY OrderType = "BUY" //deprecated after 2020 SELL OrderType = "SELL" //deprecated after 2020 )
Variables ¶
This section is empty.
Functions ¶
func ComputeBase64Hmac256 ¶
func ComputeHmac1 ¶
func ComputeHmac256 ¶
func ComputeHmac256Base64 ¶
func ComputeHmac256NoDecode ¶
func ComputeHmac256URL ¶
func ComputeHmac512 ¶
func ComputeHmac512NoDecode ¶
func ComputeHmacMd5 ¶
func GetExternalIP ¶
func GetExternalIP() string
func Map2UrlQuery ¶
将map格式的请求参数转换为字符串格式的 mapParams: map格式的参数键值对 return: 查询字符串
func Map2UrlQueryInterface ¶
func Map2UrlQueryUrl ¶
Types ¶
type AccountOperation ¶
type AccountOperation struct {
ID int `json:"id"` //dummy at this moment for
Type OperationType `json:"type"`
Ex ExchangeName `json:"exchange_name"`
Sandbox bool `json:"sandbox"`
TestMode bool `json:"test_mode"`
//#Transfer,TransferHistory,Balance,Withdraw
Coin *coin.Coin `json:"transfer_coin"` //BOT standard symbol, not the symbol on exchange
//specific operations
// #Inner Transfer
TransferFrom WalletType `json:"transfer_from"`
TransferDestination WalletType `json:"transfer_dest"`
TransferAmount string `json:"transfer_amount"`
TransferStartTime int64 `json:"transfer_start_time"`
TransferEndTime int64 `json:"transfer_end_time"`
// #SubAccount Transfer
SubTransferFrom string `json:"sub_transfer_from"`
SubTransferTo string `json:"sub_transfer_to"`
SubTransferAmount string `json:"sub_transfer_amount"`
// start/end timestamp
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
// #Withdraw
WithdrawAddress string `json:"withdraw_address"`
WithdrawTag string `json:"withdraw_tag"`
WithdrawAmount string `json:"withdraw_amount"` //here using string instead of float64
WithdrawID string `json:"withdraw_id"`
WithdrawChain string `json:"withdraw_chain"`
// #Balance
Wallet WalletType `json:"wallet"` // Contract/Spot operation. Default spot if empty
SubAccountID string `json:"sub_account_id"` // Sub account id. eg. Sub account email
//#Single Balance
BalanceAvailable float64 `json:"balance_available"` //the fund able to do trading
BalanceFrozen float64 `json:"balance_frozen"` // the fund in order or frozen can't do trading the total amount of fund should be BalanceAvailable + BalanceFrozen
//#Balance Listed
//Coin = nil
BalanceList []AssetBalance `json:"balance_list"`
// #OpenOrder, OrderHistory
OpenOrders []*Order
OrderHistory []*Order
// #GetWithdrawal/DepositHistory
WithdrawalHistory []*WDHistory
DepositHistory []*WDHistory
// #GetSubAccountList
SubAccountList []*SubAccountInfo
// #Sub Account Transfer History
SubUserName string // coinex only
TransferInHistory []*TransferHistory
TransferOutHistory []*TransferHistory
// #GetDepositAddress
// Input: Coin. Get addresses for mainnet and erc20.
DepositAddresses map[ChainType]*DepositAddr // key: chainType
//#Debug
DebugMode bool `json:"debug_mode"`
RequestURI string `json:"request_uri"`
// MapParams string `json:"map_params"`
CallResponce string `json:"call_responce"`
Error error `json:"error"`
// ##### New Changes - Contract
// OperationType WalletType `json:"operation_type"` // replace by walelt!!!
Pair *pair.Pair `json:"pair"`
Rate float64
StopRate float64 // for STOP_LIMIT, STOP_MARKET
Quantity float64
Order *Order
OrderType OrderPriceType // eg. FOK
TradeType OrderTradeType // eg. TRADE_LIMIT
OrderDirection TradeDirection //TradeDirection
Leverage int
//### new start from FTX
OpenPositionList OpenPositions
//for binance
BinanceOpenPositionList BinancePositions
Data json.RawMessage //semi-processed data
}
type AssetBalance ¶
type AssetBalance struct {
Coin *coin.Coin `json:"balance_coin"`
Balance float64 `json:"balance"`
BalanceAvailable float64 `json:"balance_available"` //the fund able to do trading
BalanceFrozen float64 `json:"balance_frozen"` // the fund in order or frozen can't do trading the total amount of fund should be BalanceAvailable + BalanceFrozen
}
type BinancePositions ¶
type BinancePositions []struct {
Symbol string `json:"symbol"`
PositionAmt string `json:"positionAmt"`
EntryPrice string `json:"entryPrice"`
MarkPrice string `json:"markPrice"`
UnRealizedProfit string `json:"unRealizedProfit"`
LiquidationPrice string `json:"liquidationPrice"`
Leverage string `json:"leverage"`
MaxNotionalValue string `json:"maxNotionalValue"`
MarginType string `json:"marginType"`
IsolatedMargin string `json:"isolatedMargin"`
IsAutoAddMargin string `json:"isAutoAddMargin"`
PositionSide string `json:"positionSide"`
Notional string `json:"notional"`
IsolatedWallet string `json:"isolatedWallet"`
UpdateTime int64 `json:"updateTime"`
}
type ChainTypeRequest ¶
type CoinConstraint ¶
type ConstrainFetchMethod ¶
type ConstrainFetchMethod struct {
PublicAPI bool
PrivateAPI bool
HealthAPI bool // get exchange health status from exchange's API directly
HasWithdraw bool // has withdraw method implemented
HasTransfer bool // has transfer method
Fee bool // true only when get Fee from API directly
LotSize bool
PriceFilter bool
TxFee bool
Withdraw bool
Deposit bool
Confirmation bool
ConstrainSource int // 1)API 2)WEB 3)Manual
ApiRestrictIP bool
}
type ContractTransDir ¶
type ContractTransDir string
type DataSource ¶
type DataSource string
type DepositAddr ¶
type Exchange ¶
type Exchange interface {
InitData() error
/***** Exchange Information *****/
GetID() int
GetName() ExchangeName
GetTradingWebURL(pair *pair.Pair) string
GetBalance(coin *coin.Coin) float64
/***** Coin Information *****/
GetCoinConstraint(coin *coin.Coin) *CoinConstraint
SetCoinConstraint(coinConstraint *CoinConstraint)
GetCoins() []*coin.Coin
GetCoinBySymbol(symbol string) *coin.Coin
GetSymbolByCoin(coin *coin.Coin) string
DeleteCoin(coin *coin.Coin)
/***** Pair Information *****/
GetPairConstraint(pair *pair.Pair) *PairConstraint
SetPairConstraint(pairConstraint *PairConstraint)
GetPairs() []*pair.Pair
GetPairBySymbol(symbol string) *pair.Pair
GetSymbolByPair(pair *pair.Pair) string
HasPair(*pair.Pair) bool
DeletePair(pair *pair.Pair)
/***** Public API *****/
GetCoinsData() error
GetPairsData() error
OrderBook(p *pair.Pair) (*Maker, error)
/***** Private API *****/
UpdateAllBalances()
Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
LimitSell(pair *pair.Pair, quantity, rate float64) (*Order, error)
LimitBuy(pair *pair.Pair, quantity, rate float64) (*Order, error)
OrderStatus(order *Order) error
ListOrders() ([]*Order, error)
CancelOrder(order *Order) error
CancelAllOrder() error //TODO need to impl cancel all order for exchanges
/***** Exchange Constraint *****/
GetConstraintFetchMethod(pair *pair.Pair) *ConstrainFetchMethod
UpdateConstraint()
/***** Coin Constraint *****/
GetTxFee(coin *coin.Coin) float64
CanWithdraw(coin *coin.Coin) bool
CanDeposit(coin *coin.Coin) bool
GetConfirmation(coin *coin.Coin) int
/***** Pair Constraint *****/
GetFee(pair *pair.Pair) float64
GetLotSize(pair *pair.Pair) float64
GetPriceFilter(pair *pair.Pair) float64
/***** Ver 2.0 Operation Base Interface *****/
LoadPublicData(operation *PublicOperation) error
DoAccountOperation(operation *AccountOperation) error
}
type ExchangeManager ¶
type ExchangeManager struct {
}
func CreateExchangeManager ¶
func CreateExchangeManager() *ExchangeManager
func (*ExchangeManager) Add ¶
func (e *ExchangeManager) Add(exchange Exchange)
func (*ExchangeManager) Get ¶
func (e *ExchangeManager) Get(name ExchangeName) Exchange
func (*ExchangeManager) GetById ¶
func (e *ExchangeManager) GetById(i int) Exchange
func (*ExchangeManager) GetExchanges ¶
func (e *ExchangeManager) GetExchanges() []Exchange
func (*ExchangeManager) GetID ¶
func (e *ExchangeManager) GetID(name ExchangeName) int
func (*ExchangeManager) GetStr ¶
func (e *ExchangeManager) GetStr(name string) Exchange
func (*ExchangeManager) GetSupportExchanges ¶
func (e *ExchangeManager) GetSupportExchanges() []ExchangeName
func (*ExchangeManager) Quantity ¶
func (e *ExchangeManager) Quantity() int
func (*ExchangeManager) SubsetPairs ¶
func (e *ExchangeManager) SubsetPairs(e1, e2 Exchange) []*pair.Pair
func (*ExchangeManager) UpdateExData ¶
func (e *ExchangeManager) UpdateExData(conf *Update)
type ExchangeName ¶
type ExchangeName string
type FutureStats ¶
type KlineDetail ¶
type KlineDetail struct {
ID int `json:"id" gorm:"primary_key;AUTO_INCREMENT"`
Exchange ExchangeName `json:"exchange"`
Pair string `json:"pair"`
OpenTime float64 `json:"open_time"`
Open float64 `json:"open"`
High float64 `json:"high"`
Low float64 `json:"low"`
Close float64 `json:"close"`
Volume float64 `json:"volume"`
CloseTime float64 `json:"close_time"`
QuoteAssetVolume float64 `json:"quote_asset_volume"`
TradesCount float64 `json:"trades_count"`
TakerBuyBaseVolume float64 `json:"taker_buy_base_volume"`
TakerBuyQuoteVolume float64 `json:"taker_buy_quote_volume"`
}
type Maker ¶
type Maker struct {
WorkerIP string `bson:"workerip"`
WorkerDeadTS float64 `bson:"workerdeadts"`
Source DataSource `bson:"source"`
BeforeTimestamp float64 `bson:"beforetimestamp"`
AfterTimestamp float64 `bson:"aftertimestamp"`
Timestamp float64 `bson:"timestamp"`
Nounce int `bson:"nounce"`
LastUpdateID int64 `json:"lastUpdateId"`
Bids []Order `json:"bids"`
Asks []Order `json:"asks"`
}
type Margin ¶
type Margin struct {
Action MarginAction
Pair *pair.Pair
Currency *coin.Coin
Rate float64
Quantity float64
TransferID int
Order *Order
MarginOrder *MarginOrder
MarginBalance *MarginBalance
}
type MarginAction ¶
type MarginAction string
type MarginBalance ¶
type MarginBalance struct {
ID int `json:"id"`
Type string `json:"type"`
State string `json:"state"`
Symbol string `json:"symbol"`
FlPrice string `json:"fl-price"`
FlType string `json:"fl-type"`
RiskRate string `json:"risk-rate"`
List []struct {
Currency string `json:"currency"`
Type string `json:"type"`
Balance string `json:"balance"`
} `json:"list"`
}
type MarginOrder ¶
type OffSetType ¶
type OffSetType string
type OpenPositions ¶
type OpenPositions []struct {
Future string `json:"future"`
Size float64 `json:"size"`
Side string `json:"side"`
NetSize float64 `json:"netSize"`
LongOrderSize float64 `json:"longOrderSize"`
ShortOrderSize float64 `json:"shortOrderSize"`
Cost float64 `json:"cost"`
EntryPrice float64 `json:"entryPrice"`
UnrealizedPnl float64 `json:"unrealizedPnl"`
RealizedPnl float64 `json:"realizedPnl"`
InitialMarginRequirement float64 `json:"initialMarginRequirement"`
MaintenanceMarginRequirement float64 `json:"maintenanceMarginRequirement"`
OpenSize float64 `json:"openSize"`
CollateralUsed float64 `json:"collateralUsed"`
EstimatedLiquidationPrice float64 `json:"estimatedLiquidationPrice"`
RecentAverageOpenPrice float64 `json:"recentAverageOpenPrice"`
RecentPnl float64 `json:"recentPnl"`
RecentBreakEvenPrice float64 `json:"recentBreakEvenPrice"`
CumulativeBuySize float64 `json:"cumulativeBuySize"`
CumulativeSellSize float64 `json:"cumulativeSellSize"`
}
type OperationType ¶
type OperationType string
const ( Withdraw OperationType = "Withdraw" Transfer OperationType = "Transfer" // transfer between inneral wallet SubAccountTransfer OperationType = "SubAccountTransfer" // transfer between main/sub account Balance OperationType = "Balance" // balance(s) of different accounts BalanceList OperationType = "BalanceAll" // balance(s) of different accounts SubBalanceList OperationType = "SubBalanceList" // balance(s) of subaccount SubAllBalanceList OperationType = "SubAllBalanceList" // balance(s) of all subaccounts GetSubAccountList OperationType = "GetSubAccountList" // get sub accounts list GetPositionInfo OperationType = "GetPositionInfo" // position information for Contract GetPositions OperationType = "GetPositions" // open positions' list for the contract 3 GetFutureStats OperationType = "GetFutureStats" GetAccount OperationType = "GetAccount" //Public Query GetCoin OperationType = "GetCoin" GetPair OperationType = "GetPair" TradeHistory OperationType = "TradeHistory" Orderbook OperationType = "Orderbook" CoinChainType OperationType = "CoinChainType" KLine OperationType = "KLine" GetTickerPrice OperationType = "GetTickerPrice" //Trade (Private Action) PlaceOrder OperationType = "PlaceOrder" CancelOrder OperationType = "CancelOrder" GetOrderStatus OperationType = "GetOrderStatus" //User (Private Action) GetOpenOrder OperationType = "GetOpenOrder" // New and Partial Orders GetOrderHistory OperationType = "GetOrderHistory" // All Orders other than open orders GetDepositHistory OperationType = "GetDepositHistory" GetWithdrawalHistory OperationType = "GetWithdrawalHistory" GetTransferHistory OperationType = "GetTransferHistory" GetDepositAddress OperationType = "GetDepositAddress" // Get address for one coin // Contract GetFutureBalance OperationType = "GetFutureBalance" SetFutureLeverage OperationType = "SetFutureLeverage" )
type Order ¶
type Order struct {
EX ExchangeName
Pair *pair.Pair
OrderID string
FilledOrders []int64
Rate float64 `bson:"Rate"`
Quantity float64 `bson:"Quantity"`
Side OrderType //TODO SIDE ==> Direction, depreated after all changed. All gored, goredws fixed.
Direction TradeDirection
Status OrderStatus `json:"status"`
StatusMessage string
DealRate float64
DealQuantity float64
Timestamp int64 `bson:"timestamp"`
JsonResponse string
Canceled bool
CancelStatus string
Error error
}
type OrderPriceType ¶
type OrderPriceType string
type OrderStatus ¶
type OrderStatus string
const ( New OrderStatus = "New" Filled OrderStatus = "Filled" Partial OrderStatus = "Partial" Canceling OrderStatus = "Canceling" Cancelled OrderStatus = "Cancelled" Rejected OrderStatus = "Rejected" Expired OrderStatus = "Expired" Other OrderStatus = "Other" )
type OrderTradeType ¶
type OrderTradeType string
const ( TRADE_LIMIT OrderTradeType = "LIMIT" TRADE_MARKET OrderTradeType = "MARKET" // Stop order need 'StopRate' param Trade_STOP_LIMIT OrderTradeType = "STOP" Trade_STOP_MARKET OrderTradeType = "STOP_MARKET" //TODO Types below need more params, Trade_TAKE_PROFIT OrderTradeType = "TAKE_PROFIT" Trade_TAKE_PROFIT_MARKET OrderTradeType = "TAKE_PROFIT_MARKET" Trade_TRAILING_STOP_MARKET OrderTradeType = "TRAILING_STOP_MARKET" )
type PairConstraint ¶
type PairConstraint struct {
PairID int
Pair *pair.Pair //the code on excahnge with the same chain, eg: BCH, BCC on different exchange, but they are the same chain
ExID string
ExSymbol string
MakerFee float64
TakerFee float64
LotSize float64 // the decimal place for this coin on exchange for the pairs, eg: BTC: 0.00001 NEO:1 LTC: 0.001 ETH:0.01
PriceFilter float64
MinTradeQuantity float64 // minimum trade target quantity
MinTradeBaseQuantity float64 // minimum trade base quantity
Listed bool
Issue string //the issue for the pair if have any problem
}
type PublicOperation ¶
type PublicOperation struct {
ID int `json:"id"` //dummy at this moment for
Type OperationType `json:"type"`
EX ExchangeName `json:"exchange_name"`
TestMode bool `json:"test_mode"`
Coin *coin.Coin `json:"op_coin"` //BOT standard symbol, not the symbol on exchange
Pair *pair.Pair `json:"op_pair"`
Maker *Maker `json:"maker"`
TradeHistory []*TradeDetail `json:"history"`
CoinChainType []ChainType `json:"chain_type"`
KlineInterval string `json:"kline_interval"`
KlineStartTime int64 `json:"kline_start_time"`
KlineEndTime int64 `json:"kline_end_time"`
Kline []*KlineDetail `json:"kline"`
TickerPrice []*TickerPriceDetail `json:"ticker_price"`
FutureStats *FutureStats
//#Debug
DebugMode bool `json:"debug mode"`
RequestURI string `json:"request_uri"`
CallResponce string `json:"call_responce"`
//#Network
Proxy string `json:"proxy"`
Timeout int `json:"timeout"`
Error error `json:"error"`
// ##### New Changes - Contract
Wallet WalletType `json:"wallet"` // Contract/Spot operation. Default spot if empty
}
type SubAccountInfo ¶
type SubAccountInfo struct {
ID string `json:"id"` // account ID, email, etc.
Status string `json:"status"`
Activated bool `json:"activated"`
AccountType WalletType `json:"account_type"`
TimeStamp int64 `json:"timestamp"`
}
type TickerPriceDetail ¶
type TradeDetail ¶
type TradeDirection ¶
type TradeDirection string
type TransferHistory ¶
type TransferType ¶
type TransferType string
const ( TransferIn TransferType = "TransferIn" TransferOut TransferType = "TransferOut" )
type Update ¶
type Update struct {
ExNames []ExchangeName
Method UpdateMethod
Time time.Duration
}
type UpdateMethod ¶
type UpdateMethod string
type WDHistory ¶
type WDHistory struct {
ID string `json:"id"`
Coin *coin.Coin `json:"wd_history_coin"`
Quantity float64 `json:"quantity"`
Tag string `json:"tag"`
Address string `json:"address"`
TxHash string `json:"txhash"`
ChainType ChainType `json:"chain_type"`
Status string `json:"status"`
TimeStamp int64 `json:"timestamp"`
}
type WalletType ¶
type WalletType string
const ( AssetWallet WalletType = "AssetWallet" SpotWallet WalletType = "SpotWallet" FiatOTCWallet WalletType = "FiatOTCWallet" MarginWallet WalletType = "MarginWallet" // ##### New - Contract ContractWallet WalletType = "ContractWallet" )
Click to show internal directories.
Click to hide internal directories.