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

     1  package okex
     2  
     3  import "time"
     4  
     5  type WSTicker struct {
     6  	Last           string    `json:"last"`
     7  	Open24H        string    `json:"open_24h"`
     8  	BestBid        string    `json:"best_bid"`
     9  	High24H        string    `json:"high_24h"`
    10  	Low24H         string    `json:"low_24h"`
    11  	Volume24H      string    `json:"volume_24h"`
    12  	VolumeToken24H string    `json:"volume_token_24h"`
    13  	BestAsk        string    `json:"best_ask"`
    14  	OpenInterest   string    `json:"open_interest"`
    15  	InstrumentID   string    `json:"instrument_id"`
    16  	Timestamp      time.Time `json:"timestamp"`
    17  	BestBidSize    string    `json:"best_bid_size"`
    18  	BestAskSize    string    `json:"best_ask_size"`
    19  	LastQty        string    `json:"last_qty"`
    20  }
    21  
    22  type WSTickerResult struct {
    23  	Table string     `json:"table"`
    24  	Data  []WSTicker `json:"data"`
    25  }
    26  
    27  type WSTrade struct {
    28  	Side         string    `json:"side"`
    29  	TradeID      string    `json:"trade_id"`
    30  	Price        string    `json:"price"`
    31  	Qty          string    `json:"qty"`
    32  	InstrumentID string    `json:"instrument_id"`
    33  	Timestamp    time.Time `json:"timestamp"`
    34  }
    35  
    36  type WSTradeResult struct {
    37  	Table string    `json:"table"`
    38  	Data  []WSTrade `json:"data"`
    39  }
    40  
    41  type WSDepthL2Tbt struct {
    42  	InstrumentID string     `json:"instrument_id"`
    43  	Asks         [][]string `json:"asks"`
    44  	Bids         [][]string `json:"bids"`
    45  	Timestamp    time.Time  `json:"timestamp"`
    46  	Checksum     int        `json:"checksum"`
    47  }
    48  
    49  type WSDepthL2TbtResult struct {
    50  	Table  string         `json:"table"`
    51  	Action string         `json:"action"`
    52  	Data   []WSDepthL2Tbt `json:"data"`
    53  }
    54  
    55  type WSAccountResult struct {
    56  	Table string          `json:"table"`
    57  	Data  []WSAccountData `json:"data"`
    58  }
    59  
    60  type WSAccount struct {
    61  	Available         string    `json:"available"`
    62  	CanWithdraw       string    `json:"can_withdraw"`
    63  	Currency          string    `json:"currency"`
    64  	Equity            string    `json:"equity"`
    65  	LiquiMode         string    `json:"liqui_mode"`
    66  	MaintMarginRatio  string    `json:"maint_margin_ratio"`
    67  	Margin            string    `json:"margin"`
    68  	MarginForUnfilled string    `json:"margin_for_unfilled"`
    69  	MarginFrozen      string    `json:"margin_frozen"`
    70  	MarginMode        string    `json:"margin_mode"`
    71  	MarginRatio       string    `json:"margin_ratio"`
    72  	OpenMax           string    `json:"open_max"`
    73  	RealizedPnl       string    `json:"realized_pnl"`
    74  	Timestamp         time.Time `json:"timestamp"`
    75  	TotalAvailBalance string    `json:"total_avail_balance"`
    76  	Underlying        string    `json:"underlying"`
    77  	UnrealizedPnl     string    `json:"unrealized_pnl"`
    78  }
    79  
    80  type WSAccountData struct {
    81  	BTC *WSAccount `json:"BTC"`
    82  	LTC *WSAccount `json:"LTC"`
    83  	ETH *WSAccount `json:"ETH"`
    84  	ETC *WSAccount `json:"ETC"`
    85  	XRP *WSAccount `json:"XRP"`
    86  	EOS *WSAccount `json:"EOS"`
    87  	BCH *WSAccount `json:"BCH"`
    88  	BSV *WSAccount `json:"BSV"`
    89  	TRX *WSAccount `json:"TRX"`
    90  }
    91  
    92  type WSOrder struct {
    93  	Leverage     string    `json:"leverage"`
    94  	LastFillTime time.Time `json:"last_fill_time"`
    95  	FilledQty    string    `json:"filled_qty"`
    96  	Fee          string    `json:"fee"`
    97  	PriceAvg     string    `json:"price_avg"`
    98  	Type         string    `json:"type"`
    99  	ClientOid    string    `json:"client_oid"`
   100  	LastFillQty  string    `json:"last_fill_qty"`
   101  	InstrumentID string    `json:"instrument_id"`
   102  	LastFillPx   string    `json:"last_fill_px"`
   103  	Pnl          string    `json:"pnl"`
   104  	Size         string    `json:"size"`
   105  	Price        string    `json:"price"`
   106  	LastFillID   string    `json:"last_fill_id"`
   107  	ErrorCode    string    `json:"error_code"`
   108  	State        string    `json:"state"`
   109  	ContractVal  string    `json:"contract_val"`
   110  	OrderID      string    `json:"order_id"`
   111  	OrderType    string    `json:"order_type"`
   112  	Timestamp    time.Time `json:"timestamp"`
   113  	Status       string    `json:"status"`
   114  }
   115  
   116  type WSOrderResult struct {
   117  	Table string    `json:"table"`
   118  	Data  []WSOrder `json:"data"`
   119  }