github.com/frankrap/okex-api@v1.0.4/swap_results.go (about)

     1  package okex
     2  
     3  /*
     4   OKEX api result definition
     5   @author Lingting Fu
     6   @date 2018-12-27
     7   @version 1.0.0
     8  */
     9  
    10  type SwapPositionHolding struct {
    11  	LiquidationPrice string `json:"liquidation_price"`
    12  	Position         string `json:"position"`
    13  	AvailPosition    string `json:"avail_position"`
    14  	AvgCost          string `json:"avg_cost"`
    15  	SettlementPrice  string `json:"settlement_price"`
    16  	InstrumentId     string `json:"instrument_id"`
    17  	Leverage         string `json:"leverage"`
    18  	RealizedPnl      string `json:"realized_pnl"`
    19  	Side             string `json:"side"`
    20  	Timestamp        string `json:"timestamp"`
    21  	Margin           string `json:"margin";default:""`
    22  }
    23  
    24  type SwapPosition struct {
    25  	BizWarmTips
    26  	MarginMode string                `json:"margin_mode"`
    27  	Holding    []SwapPositionHolding `json:"holding"`
    28  }
    29  
    30  type SwapPositionList []SwapPosition
    31  
    32  type SwapAccountInfo struct {
    33  	InstrumentId      string `json:"instrument_id"`
    34  	Timestamp         string `json:"timestamp"`
    35  	MarginFrozen      string `json:"margin_frozen"`
    36  	TotalAvailBalance string `json:"total_avail_balance"`
    37  	MarginRatio       string `json:"margin_ratio"`
    38  	RealizedPnl       string `json:"realized_pnl"`
    39  	UnrealizedPnl     string `json:"unrealized_pnl"`
    40  	FixedBalance      string `json:"fixed_balance"`
    41  	Equity            string `json:"equity"`
    42  	Margin            string `json:"margin"`
    43  	MarginMode        string `json:"margin_mode"`
    44  }
    45  
    46  type SwapAccounts struct {
    47  	BizWarmTips
    48  	Info []SwapAccountInfo `json:"info"`
    49  }
    50  
    51  type SwapAccount struct {
    52  	Info SwapAccountInfo `json:"info"`
    53  }
    54  
    55  type BaseSwapOrderResult struct {
    56  	OrderId      string `json:"order_id"`
    57  	ClientOid    string `json:"client_oid"`
    58  	ErrorMessage string `json:"error_message"`
    59  	ErrorCode    string `json:"error_code"`
    60  	Result       string `json:"result"`
    61  }
    62  
    63  type SwapOrderResult struct {
    64  	BaseSwapOrderResult
    65  	BizWarmTips
    66  }
    67  
    68  type SwapOrdersResult struct {
    69  	BizWarmTips
    70  	OrderInfo []BaseSwapOrderResult `json:"order_info"`
    71  }
    72  
    73  type SwapCancelOrderResult struct {
    74  	ErrorMessage string `json:"error_message"`
    75  	ErrorCode    string `json:"error_code"`
    76  	OrderId      string `json:"order_id"`
    77  	Result       string `json:"result"`
    78  }
    79  
    80  type SwapBatchCancelOrderResult struct {
    81  	BizWarmTips
    82  	InstrumentId string   `json:"instrument_id"`
    83  	Ids          []string `json:"ids"`
    84  	Result       string   `json:"result"`
    85  }
    86  
    87  type BaseOrderInfo struct {
    88  	InstrumentId string  `json:"instrument_id"`
    89  	Status       string  `json:"status"`
    90  	OrderId      string  `json:"order_id"`
    91  	Timestamp    string  `json:"timestamp"`
    92  	Price        float64 `json:"price,string"`
    93  	PriceAvg     float64 `json:"price_avg,string"`
    94  	Size         int64   `json:"size,string"`
    95  	Fee          float64 `json:"fee,string"`
    96  	FilledQty    float64 `json:"filled_qty,string"`
    97  	ContractVal  string  `json:"contract_val"`
    98  	Type         float64 `json:"type,string"`
    99  	OrderType    string  `json:"order_type"`
   100  	State        int     `json:"state,string"`
   101  }
   102  
   103  type SwapOrdersInfo struct {
   104  	BizWarmTips
   105  	OrderInfo []BaseOrderInfo `json:"order_info"`
   106  }
   107  
   108  type BaseFillInfo struct {
   109  	InstrumentId string `json:"instrument_id"`
   110  	OrderQty     string `json:"order_qty"`
   111  	TradeId      string `json:"trade_id"`
   112  	Fee          string `json:"fee"`
   113  	OrderId      string `json:"order_id"`
   114  	Timestamp    string `json:"timestamp"`
   115  	Price        string `json:"price"`
   116  	Side         string `json:"side"`
   117  	ExecType     string `json:"exec_type"`
   118  }
   119  
   120  type SwapFillsInfo []BaseFillInfo
   121  
   122  type SwapAccountsSetting struct {
   123  	BizWarmTips
   124  	InstrumentId  string `json:"instrument_id"`
   125  	LongLeverage  string `json:"long_leverage"`
   126  	ShortLeverage string `json:"short_leverage"`
   127  	MarginMode    string `json:"margin_mode"`
   128  }
   129  
   130  type BaseLedgerInfo struct {
   131  	InstrumentId string `json:"instrument_id"`
   132  	Fee          string `json:"fee"`
   133  	Timestamp    string `json:"timestamp"`
   134  	Amount       string `json:"amount"`
   135  	LedgerId     string `json:"ledger_id"`
   136  	Type         string `json:"type"`
   137  }
   138  
   139  type SwapAccountsLedgerList []BaseLedgerInfo
   140  
   141  type BaseInstrumentInfo struct {
   142  	InstrumentId    string `json:"instrument_id"`
   143  	QuoteCurrency   string `json:"quote_currency"`
   144  	TickSize        string `json:"tick_size"`
   145  	ContractVal     string `json:"contract_val"`
   146  	Listing         string `json:"listing"`
   147  	UnderlyingIndex string `json:"underlying_index"`
   148  	Delivery        string `json:"delivery"`
   149  	Coin            string `json:"coin"`
   150  	SizeIncrement   string `json:"size_increment"`
   151  }
   152  
   153  type SwapInstrumentList []BaseInstrumentInfo
   154  
   155  type SwapInstrumentDepth struct {
   156  	BizWarmTips
   157  	Timestamp string     `json:"timestamp"`
   158  	Time      string     `json:"time"`
   159  	Bids      [][]string `json:"bids"`
   160  	Asks      [][]string `json:"asks"`
   161  }
   162  
   163  type BaseTickerInfo struct {
   164  	InstrumentId string `json:"instrument_id"`
   165  	Last         string `json:"last"`
   166  	Timestamp    string `json:"timestamp"`
   167  	High24h      string `json:"high_24h"`
   168  	Volume24h    string `json:"volume_24h"`
   169  	Low24h       string `json:"low_24h"`
   170  }
   171  
   172  type SwapTickerList []BaseTickerInfo
   173  
   174  type BaseTradeInfo struct {
   175  	Timestamp string `json:"timestamp"`
   176  	TradeId   string `json:"trade_id"`
   177  	Side      string `json:"side"`
   178  	Price     string `json:"price"`
   179  	Size      string `json:"size"`
   180  }
   181  
   182  type SwapTradeList []BaseTradeInfo
   183  
   184  type BaseCandleInfo []string
   185  type SwapCandleList []BaseCandleInfo
   186  
   187  type SwapIndexInfo struct {
   188  	BizWarmTips
   189  	InstrumentId string `json:"instrument_id"`
   190  	Index        string `json:"index"`
   191  	Timestamp    string `json:"timestamp"`
   192  }
   193  
   194  type SwapRate struct {
   195  	InstrumentId string `json:"instrument_id"`
   196  	Timestamp    string `json:"timestamp"`
   197  	Rate         string `json:"rate"`
   198  }
   199  
   200  type BaseInstrumentAmount struct {
   201  	BizWarmTips
   202  	InstrumentId string `json:"instrument_id"`
   203  	Timestamp    string `json:"timestamp"`
   204  	Amount       string `json:"amount"`
   205  }
   206  
   207  type SwapOpenInterest BaseInstrumentAmount
   208  
   209  type SwapPriceLimit struct {
   210  	BizWarmTips
   211  	InstrumentId string `json:"instrument_id"`
   212  	Lowest       string `json:"lowest"`
   213  	Highest      string `json:"highest"`
   214  	Timestamp    string `json:"timestamp"`
   215  }
   216  
   217  type BaseLiquidationInfo struct {
   218  	InstrumentId string `json:"instrument_id"`
   219  	Loss         string `json:"loss"`
   220  	CreatedAt    string `json:"created_at"`
   221  	Type         string `json:"type"`
   222  	Price        string `json:"price"`
   223  	Size         string `json:"size"`
   224  }
   225  
   226  type SwapLiquidationList []BaseLiquidationInfo
   227  
   228  type SwapAccountHolds BaseInstrumentAmount
   229  
   230  type SwapFundingTime struct {
   231  	BizWarmTips
   232  	InstrumentId string `json:"instrument_id"`
   233  	FundingTime  string `json:"funding_time"`
   234  }
   235  
   236  type SwapMarkPrice struct {
   237  	BizWarmTips
   238  	InstrumentId string `json:"instrument_id"`
   239  	MarkPrice    string `json:"mark_price"`
   240  	Timestamp    string `json:"timestamp"`
   241  }
   242  
   243  type BaseHistoricalFundingRate struct {
   244  	InstrumentId string `json:"instrument_id"`
   245  	InterestRate string `json:"interest_rate"`
   246  	FundingRate  string `json:"funding_rate"`
   247  	FundingTime  string `json:"funding_time"`
   248  	RealizedRate string `json:"realized_rate"`
   249  }
   250  
   251  type SwapHistoricalFundingRateList []BaseHistoricalFundingRate