Merge pull request #462 from c9s/c9s/refactor-ftx

refactor: refactor ftx implementation and clean up legacy methods
This commit is contained in:
Yo-An Lin 2022-03-03 15:07:42 +08:00 committed by GitHub
commit 3856cc6d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 175 additions and 312 deletions

View File

@ -12,12 +12,17 @@ import (
func init() {
balancesCmd.Flags().String("session", "", "the exchange session name for querying balances")
if err := balancesCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
RootCmd.AddCommand(balancesCmd)
}
// go run ./cmd/bbgo balances --session=ftx
var balancesCmd = &cobra.Command{
Use: "balances --session SESSION",
Use: "balances [--session SESSION]",
Short: "Show user account balances",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -79,21 +79,11 @@ var listOrdersCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
configFile, err := cmd.Flags().GetString("config")
if err != nil {
return err
}
if len(configFile) == 0 {
return fmt.Errorf("--config option is required")
}
if userConfig == nil {
return errors.New("config file is required")
}
environ := bbgo.NewEnvironment()
if err := environ.ConfigureExchangeSessions(userConfig); err != nil {
return err
}
@ -302,7 +292,7 @@ var executeOrderCmd = &cobra.Command{
// go run ./cmd/bbgo submit-order --session=ftx --symbol=BTCUSDT --side=buy --price=18000 --quantity=0.001
var submitOrderCmd = &cobra.Command{
Use: "submit-order --session SESSION --symbol SYMBOL --side SIDE --quantity QUANTITY [--price PRICE]",
Short: "place limit order to the exchange",
Short: "place order to the exchange",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
@ -326,17 +316,17 @@ var submitOrderCmd = &cobra.Command{
side, err := cmd.Flags().GetString("side")
if err != nil {
return fmt.Errorf("can't get side: %w", err)
return fmt.Errorf("can not get side: %w", err)
}
price, err := cmd.Flags().GetString("price")
if err != nil {
return fmt.Errorf("can't get price: %w", err)
return fmt.Errorf("can not get price: %w", err)
}
quantity, err := cmd.Flags().GetString("quantity")
if err != nil {
return fmt.Errorf("can't get quantity: %w", err)
return fmt.Errorf("can not get quantity: %w", err)
}
environ := bbgo.NewEnvironment()
@ -381,16 +371,25 @@ var submitOrderCmd = &cobra.Command{
func init() {
listOrdersCmd.Flags().String("session", "", "the exchange session name for sync")
listOrdersCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
if err := listOrdersCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
getOrderCmd.Flags().String("session", "", "the exchange session name for sync")
getOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
getOrderCmd.Flags().String("order-id", "", "order id")
if err := getOrderCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
submitOrderCmd.Flags().String("session", "", "the exchange session name for sync")
submitOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
submitOrderCmd.Flags().String("side", "", "the trading side: buy or sell")
submitOrderCmd.Flags().String("price", "", "the trading price")
submitOrderCmd.Flags().String("quantity", "", "the trading quantity")
if err := submitOrderCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
executeOrderCmd.Flags().String("session", "", "the exchange session name for sync")
executeOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
@ -401,6 +400,9 @@ func init() {
executeOrderCmd.Flags().Duration("update-interval", time.Second*10, "order update time")
executeOrderCmd.Flags().Duration("deadline", 0, "deadline of the order execution")
executeOrderCmd.Flags().Int("price-ticks", 0, "the number of price tick for the jump spread, default to 0")
if err := executeOrderCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
RootCmd.AddCommand(listOrdersCmd)
RootCmd.AddCommand(getOrderCmd)

View File

@ -560,18 +560,22 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) erro
logrus.WithError(err).Error("rate limit error")
}
var resp *ftxapi.APIResponse
var err error
if len(o.ClientOrderID) > 0 {
req := e.client.NewCancelOrderByClientOrderIdRequest(o.ClientOrderID)
_, err := req.Do(ctx)
if err != nil {
return err
}
resp, err = req.Do(ctx)
} else {
req := e.client.NewCancelOrderRequest(strconv.FormatUint(o.OrderID, 10))
_, err := req.Do(ctx)
if err != nil {
return err
}
resp, err = req.Do(ctx)
}
if err != nil {
return err
}
if !resp.Success {
return fmt.Errorf("cancel order failed: %s", resp.Result)
}
}
return nil

View File

@ -54,7 +54,6 @@ func (r *restRequest) Transfer(ctx context.Context, p TransferPayload) (transfer
type restRequest struct {
*walletRequest
*orderRequest
*marketRequest
*transferRequest
@ -88,7 +87,6 @@ func newRestRequest(c *http.Client, baseURL *url.URL) *restRequest {
r.marketRequest = &marketRequest{restRequest: r}
r.walletRequest = &walletRequest{restRequest: r}
r.orderRequest = &orderRequest{restRequest: r}
return r
}

View File

@ -14,24 +14,6 @@ type marketRequest struct {
*restRequest
}
func (r *marketRequest) Markets(ctx context.Context) (marketsResponse, error) {
resp, err := r.
Method("GET").
ReferenceURL("api/markets").
DoAuthenticatedRequest(ctx)
if err != nil {
return marketsResponse{}, err
}
var m marketsResponse
if err := json.Unmarshal(resp.Body, &m); err != nil {
return marketsResponse{}, fmt.Errorf("failed to unmarshal market response body to json: %w", err)
}
return m, nil
}
/*
supported resolutions: window length in seconds. options: 15, 60, 300, 900, 3600, 14400, 86400
doc: https://docs.ftx.com/?javascript#get-historical-prices

View File

@ -1,153 +0,0 @@
package ftx
import (
"context"
"encoding/json"
"fmt"
"strconv"
"time"
"github.com/c9s/bbgo/pkg/fixedpoint"
)
type orderRequest struct {
*restRequest
}
/*
{
"market": "XRP-PERP",
"side": "sell",
"price": 0.306525,
"type": "limit",
"size": 31431.0,
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null
}
*/
type PlaceOrderPayload struct {
Market string
Side string
Price fixedpoint.Value
Type string
Size fixedpoint.Value
ReduceOnly bool
IOC bool
PostOnly bool
ClientID string
}
func (r *orderRequest) PlaceOrder(ctx context.Context, p PlaceOrderPayload) (orderResponse, error) {
resp, err := r.
Method("POST").
ReferenceURL("api/orders").
Payloads(map[string]interface{}{
"market": p.Market,
"side": p.Side,
"price": p.Price,
"type": p.Type,
"size": p.Size,
"reduceOnly": p.ReduceOnly,
"ioc": p.IOC,
"postOnly": p.PostOnly,
"clientId": p.ClientID,
}).
DoAuthenticatedRequest(ctx)
if err != nil {
return orderResponse{}, err
}
var o orderResponse
if err := json.Unmarshal(resp.Body, &o); err != nil {
return orderResponse{}, fmt.Errorf("failed to unmarshal order response body to json: %w", err)
}
return o, nil
}
func (r *orderRequest) CancelOrderByOrderID(ctx context.Context, orderID uint64) (cancelOrderResponse, error) {
resp, err := r.
Method("DELETE").
ReferenceURL("api/orders").
ID(strconv.FormatUint(orderID, 10)).
DoAuthenticatedRequest(ctx)
if err != nil {
return cancelOrderResponse{}, err
}
var co cancelOrderResponse
if err := json.Unmarshal(resp.Body, &r); err != nil {
return cancelOrderResponse{}, err
}
return co, nil
}
func (r *orderRequest) CancelOrderByClientID(ctx context.Context, clientID string) (cancelOrderResponse, error) {
resp, err := r.
Method("DELETE").
ReferenceURL("api/orders/by_client_id").
ID(clientID).
DoAuthenticatedRequest(ctx)
if err != nil {
return cancelOrderResponse{}, err
}
var co cancelOrderResponse
if err := json.Unmarshal(resp.Body, &r); err != nil {
return cancelOrderResponse{}, err
}
return co, nil
}
func (r *orderRequest) OpenOrders(ctx context.Context, market string) (ordersResponse, error) {
resp, err := r.
Method("GET").
ReferenceURL("api/orders").
Query(map[string]string{"market": market}).
DoAuthenticatedRequest(ctx)
if err != nil {
return ordersResponse{}, err
}
var o ordersResponse
if err := json.Unmarshal(resp.Body, &o); err != nil {
return ordersResponse{}, fmt.Errorf("failed to unmarshal open orders response body to json: %w", err)
}
return o, nil
}
func (r *orderRequest) OrdersHistory(ctx context.Context, market string, start, end time.Time, limit int64) (ordersHistoryResponse, error) {
q := make(map[string]string)
if limit > 0 {
q["limit"] = strconv.FormatInt(limit, 10)
}
if len(market) > 0 {
q["market"] = market
}
if start != (time.Time{}) {
q["start_time"] = strconv.FormatInt(start.Unix(), 10)
}
if end != (time.Time{}) {
q["end_time"] = strconv.FormatInt(end.Unix(), 10)
}
resp, err := r.
Method("GET").
ReferenceURL("api/orders/history").
Query(q).
DoAuthenticatedRequest(ctx)
if err != nil {
return ordersHistoryResponse{}, err
}
var o ordersHistoryResponse
if err := json.Unmarshal(resp.Body, &o); err != nil {
return ordersHistoryResponse{}, fmt.Errorf("failed to unmarshal orders history response body to json: %w", err)
}
return o, nil
}

View File

@ -43,20 +43,3 @@ func (r *walletRequest) DepositHistory(ctx context.Context, since time.Time, unt
return d, nil
}
func (r *walletRequest) Balances(ctx context.Context) (balances, error) {
resp, err := r.
Method("GET").
ReferenceURL("api/wallet/balances").
DoAuthenticatedRequest(ctx)
if err != nil {
return balances{}, err
}
var b balances
if err := json.Unmarshal(resp.Body, &b); err != nil {
return balances{}, fmt.Errorf("failed to unmarshal balance response body to json: %w", err)
}
return b, nil
}

View File

@ -1,20 +1,20 @@
// Code generated by go generate; DO NOT EDIT.
package ftx
var symbolMap = map[string]string{
"1INCH-1231": "1INCH-1231",
"1INCH-0325": "1INCH-0325",
"1INCH-PERP": "1INCH-PERP",
"1INCHUSD": "1INCH/USD",
"AAPL-1231": "AAPL-1231",
"AAPL-0325": "AAPL-0325",
"AAPLUSD": "AAPL/USD",
"AAVE-1231": "AAVE-1231",
"AAVE-0325": "AAVE-0325",
"AAVE-PERP": "AAVE-PERP",
"AAVEUSD": "AAVE/USD",
"AAVEUSDT": "AAVE/USDT",
"ABNB-1231": "ABNB-1231",
"ABNB-0325": "ABNB-0325",
"ABNBUSD": "ABNB/USD",
"ACB-1231": "ACB-1231",
"ACB-0325": "ACB-0325",
"ACBUSD": "ACB/USD",
"ADA-1231": "ADA-1231",
"ADA-0325": "ADA-0325",
"ADA-PERP": "ADA-PERP",
"ADABEARUSD": "ADABEAR/USD",
"ADABULLUSD": "ADABULL/USD",
@ -27,7 +27,7 @@ var symbolMap = map[string]string{
"ALCX-PERP": "ALCX-PERP",
"ALCXUSD": "ALCX/USD",
"ALEPHUSD": "ALEPH/USD",
"ALGO-1231": "ALGO-1231",
"ALGO-0325": "ALGO-0325",
"ALGO-PERP": "ALGO-PERP",
"ALGOBEARUSD": "ALGOBEAR/USD",
"ALGOBULLUSD": "ALGOBULL/USD",
@ -37,25 +37,24 @@ var symbolMap = map[string]string{
"ALICEUSD": "ALICE/USD",
"ALPHA-PERP": "ALPHA-PERP",
"ALPHAUSD": "ALPHA/USD",
"ALT-1231": "ALT-1231",
"ALT-0325": "ALT-0325",
"ALT-PERP": "ALT-PERP",
"ALTBEARUSD": "ALTBEAR/USD",
"ALTBULLUSD": "ALTBULL/USD",
"ALTHALFUSD": "ALTHALF/USD",
"ALTHEDGEUSD": "ALTHEDGE/USD",
"AMC-1231": "AMC-1231",
"AMC-0325": "AMC-0325",
"AMCUSD": "AMC/USD",
"AMD-1231": "AMD-1231",
"AMD-0325": "AMD-0325",
"AMDUSD": "AMD/USD",
"AMPL-PERP": "AMPL-PERP",
"AMPLUSD": "AMPL/USD",
"AMPLUSDT": "AMPL/USDT",
"AMZN-1231": "AMZN-1231",
"AMZN-0325": "AMZN-0325",
"AMZNUSD": "AMZN/USD",
"APHA-1231": "APHA-1231",
"APHAUSD": "APHA/USD",
"AR-PERP": "AR-PERP",
"ARKK-1231": "ARKK-1231",
"ARKK-0325": "ARKK-0325",
"ARKKUSD": "ARKK/USD",
"ASD-PERP": "ASD-PERP",
"ASDBEARUSD": "ASDBEAR/USD",
@ -67,25 +66,30 @@ var symbolMap = map[string]string{
"ASDUSD": "ASD/USD",
"ATLAS-PERP": "ATLAS-PERP",
"ATLASUSD": "ATLAS/USD",
"ATOM-1231": "ATOM-1231",
"ATOM-0325": "ATOM-0325",
"ATOM-PERP": "ATOM-PERP",
"ATOMBEARUSD": "ATOMBEAR/USD",
"ATOMBULLUSD": "ATOMBULL/USD",
"ATOMHALFUSD": "ATOMHALF/USD",
"ATOMHEDGEUSD": "ATOMHEDGE/USD",
"ATOMUSD": "ATOM/USD",
"ATOMUSDT": "ATOM/USDT",
"AUDIO-PERP": "AUDIO-PERP",
"AUDIOUSD": "AUDIO/USD",
"AUDIOUSDT": "AUDIO/USDT",
"AURYUSD": "AURY/USD",
"AVAX-1231": "AVAX-1231",
"AVAX-0325": "AVAX-0325",
"AVAX-PERP": "AVAX-PERP",
"AVAXBTC": "AVAX/BTC",
"AVAXUSD": "AVAX/USD",
"AVAXUSDT": "AVAX/USDT",
"AXS-PERP": "AXS-PERP",
"AXSUSD": "AXS/USD",
"BABA-1231": "BABA-1231",
"BABA-0325": "BABA-0325",
"BABAUSD": "BABA/USD",
"BADGER-PERP": "BADGER-PERP",
"BADGERUSD": "BADGER/USD",
"BAL-1231": "BAL-1231",
"BAL-0325": "BAL-0325",
"BAL-PERP": "BAL-PERP",
"BALBEARUSD": "BALBEAR/USD",
"BALBEARUSDT": "BALBEAR/USDT",
@ -102,9 +106,9 @@ var symbolMap = map[string]string{
"BARUSD": "BAR/USD",
"BAT-PERP": "BAT-PERP",
"BATUSD": "BAT/USD",
"BB-1231": "BB-1231",
"BB-0325": "BB-0325",
"BBUSD": "BB/USD",
"BCH-1231": "BCH-1231",
"BCH-0325": "BCH-0325",
"BCH-PERP": "BCH-PERP",
"BCHBEARUSD": "BCHBEAR/USD",
"BCHBEARUSDT": "BCHBEAR/USDT",
@ -119,16 +123,16 @@ var symbolMap = map[string]string{
"BEARUSD": "BEAR/USD",
"BEARUSDT": "BEAR/USDT",
"BICOUSD": "BICO/USD",
"BILI-1231": "BILI-1231",
"BILI-0325": "BILI-0325",
"BILIUSD": "BILI/USD",
"BIT-PERP": "BIT-PERP",
"BITO-1231": "BITO-1231",
"BITO-0325": "BITO-0325",
"BITOUSD": "BITO/USD",
"BITUSD": "BIT/USD",
"BITW-1231": "BITW-1231",
"BITW-0325": "BITW-0325",
"BITWUSD": "BITW/USD",
"BLTUSD": "BLT/USD",
"BNB-1231": "BNB-1231",
"BNB-0325": "BNB-0325",
"BNB-PERP": "BNB-PERP",
"BNBBEARUSD": "BNBBEAR/USD",
"BNBBEARUSDT": "BNBBEAR/USDT",
@ -141,7 +145,7 @@ var symbolMap = map[string]string{
"BNBUSDT": "BNB/USDT",
"BNT-PERP": "BNT-PERP",
"BNTUSD": "BNT/USD",
"BNTX-1231": "BNTX-1231",
"BNTX-0325": "BNTX-0325",
"BNTXUSD": "BNTX/USD",
"BOBA-PERP": "BOBA-PERP",
"BOBAUSD": "BOBA/USD",
@ -149,7 +153,7 @@ var symbolMap = map[string]string{
"BRZ-PERP": "BRZ-PERP",
"BRZUSD": "BRZ/USD",
"BRZUSDT": "BRZ/USDT",
"BSV-1231": "BSV-1231",
"BSV-0325": "BSV-0325",
"BSV-PERP": "BSV-PERP",
"BSVBEARUSD": "BSVBEAR/USD",
"BSVBEARUSDT": "BSVBEAR/USDT",
@ -158,16 +162,16 @@ var symbolMap = map[string]string{
"BSVHALFUSD": "BSVHALF/USD",
"BSVHEDGEUSD": "BSVHEDGE/USD",
"BTC-0325": "BTC-0325",
"BTC-1231": "BTC-1231",
"BTC-MOVE-1209": "BTC-MOVE-1209",
"BTC-MOVE-1210": "BTC-MOVE-1210",
"BTC-MOVE-2021Q4": "BTC-MOVE-2021Q4",
"BTC-0624": "BTC-0624",
"BTC-MOVE-0303": "BTC-MOVE-0303",
"BTC-MOVE-0304": "BTC-MOVE-0304",
"BTC-MOVE-2022Q1": "BTC-MOVE-2022Q1",
"BTC-MOVE-2022Q2": "BTC-MOVE-2022Q2",
"BTC-MOVE-WK-1210": "BTC-MOVE-WK-1210",
"BTC-MOVE-WK-1217": "BTC-MOVE-WK-1217",
"BTC-MOVE-WK-1224": "BTC-MOVE-WK-1224",
"BTC-MOVE-WK-1231": "BTC-MOVE-WK-1231",
"BTC-MOVE-2022Q3": "BTC-MOVE-2022Q3",
"BTC-MOVE-WK-0304": "BTC-MOVE-WK-0304",
"BTC-MOVE-WK-0311": "BTC-MOVE-WK-0311",
"BTC-MOVE-WK-0318": "BTC-MOVE-WK-0318",
"BTC-MOVE-WK-0325": "BTC-MOVE-WK-0325",
"BTC-PERP": "BTC-PERP",
"BTCBRZ": "BTC/BRZ",
"BTCEUR": "BTC/EUR",
@ -175,28 +179,29 @@ var symbolMap = map[string]string{
"BTCUSD": "BTC/USD",
"BTCUSDT": "BTC/USDT",
"BTT-PERP": "BTT-PERP",
"BTTUSD": "BTT/USD",
"BULLSHITUSD": "BULLSHIT/USD",
"BULLUSD": "BULL/USD",
"BULLUSDT": "BULL/USDT",
"BVOLBTC": "BVOL/BTC",
"BVOLUSD": "BVOL/USD",
"BVOLUSDT": "BVOL/USDT",
"BYND-1231": "BYND-1231",
"BYND-0325": "BYND-0325",
"BYNDUSD": "BYND/USD",
"C98-PERP": "C98-PERP",
"C98USD": "C98/USD",
"CADUSD": "CAD/USD",
"CAKE-PERP": "CAKE-PERP",
"CEL-1231": "CEL-1231",
"CEL-0325": "CEL-0325",
"CEL-PERP": "CEL-PERP",
"CELBTC": "CEL/BTC",
"CELO-PERP": "CELO-PERP",
"CELUSD": "CEL/USD",
"CGC-1231": "CGC-1231",
"CGC-0325": "CGC-0325",
"CGCUSD": "CGC/USD",
"CHR-PERP": "CHR-PERP",
"CHRUSD": "CHR/USD",
"CHZ-1231": "CHZ-1231",
"CHZ-0325": "CHZ-0325",
"CHZ-PERP": "CHZ-PERP",
"CHZUSD": "CHZ/USD",
"CHZUSDT": "CHZ/USDT",
@ -204,7 +209,7 @@ var symbolMap = map[string]string{
"CLV-PERP": "CLV-PERP",
"CLVUSD": "CLV/USD",
"COINUSD": "COIN/USD",
"COMP-1231": "COMP-1231",
"COMP-0325": "COMP-0325",
"COMP-PERP": "COMP-PERP",
"COMPBEARUSD": "COMPBEAR/USD",
"COMPBEARUSDT": "COMPBEAR/USDT",
@ -222,7 +227,7 @@ var symbolMap = map[string]string{
"CREAMUSD": "CREAM/USD",
"CREAMUSDT": "CREAM/USDT",
"CRO-PERP": "CRO-PERP",
"CRON-1231": "CRON-1231",
"CRON-0325": "CRON-0325",
"CRONUSD": "CRON/USD",
"CROUSD": "CRO/USD",
"CRV-PERP": "CRV-PERP",
@ -243,7 +248,7 @@ var symbolMap = map[string]string{
"DASH-PERP": "DASH-PERP",
"DAWN-PERP": "DAWN-PERP",
"DAWNUSD": "DAWN/USD",
"DEFI-1231": "DEFI-1231",
"DEFI-0325": "DEFI-0325",
"DEFI-PERP": "DEFI-PERP",
"DEFIBEARUSD": "DEFIBEAR/USD",
"DEFIBEARUSDT": "DEFIBEAR/USDT",
@ -254,13 +259,13 @@ var symbolMap = map[string]string{
"DENT-PERP": "DENT-PERP",
"DENTUSD": "DENT/USD",
"DFLUSD": "DFL/USD",
"DKNG-1231": "DKNG-1231",
"DKNG-0325": "DKNG-0325",
"DKNGUSD": "DKNG/USD",
"DMGUSD": "DMG/USD",
"DMGUSDT": "DMG/USDT",
"DODO-PERP": "DODO-PERP",
"DODOUSD": "DODO/USD",
"DOGE-1231": "DOGE-1231",
"DOGE-0325": "DOGE-0325",
"DOGE-PERP": "DOGE-PERP",
"DOGEBEAR2021USD": "DOGEBEAR2021/USD",
"DOGEBTC": "DOGE/BTC",
@ -269,9 +274,12 @@ var symbolMap = map[string]string{
"DOGEHEDGEUSD": "DOGEHEDGE/USD",
"DOGEUSD": "DOGE/USD",
"DOGEUSDT": "DOGE/USDT",
"DOT-1231": "DOT-1231",
"DOT-0325": "DOT-0325",
"DOT-PERP": "DOT-PERP",
"DRGN-1231": "DRGN-1231",
"DOTBTC": "DOT/BTC",
"DOTUSD": "DOT/USD",
"DOTUSDT": "DOT/USDT",
"DRGN-0325": "DRGN-0325",
"DRGN-PERP": "DRGN-PERP",
"DRGNBEARUSD": "DRGNBEAR/USD",
"DRGNBULLUSD": "DRGNBULL/USD",
@ -279,7 +287,7 @@ var symbolMap = map[string]string{
"DRGNHEDGEUSD": "DRGNHEDGE/USD",
"DYDX-PERP": "DYDX-PERP",
"DYDXUSD": "DYDX/USD",
"EDEN-1231": "EDEN-1231",
"EDEN-0325": "EDEN-0325",
"EDEN-PERP": "EDEN-PERP",
"EDENUSD": "EDEN/USD",
"EGLD-PERP": "EGLD-PERP",
@ -288,7 +296,7 @@ var symbolMap = map[string]string{
"ENJUSD": "ENJ/USD",
"ENS-PERP": "ENS-PERP",
"ENSUSD": "ENS/USD",
"EOS-1231": "EOS-1231",
"EOS-0325": "EOS-0325",
"EOS-PERP": "EOS-PERP",
"EOSBEARUSD": "EOSBEAR/USD",
"EOSBEARUSDT": "EOSBEAR/USDT",
@ -302,7 +310,7 @@ var symbolMap = map[string]string{
"ETCHALFUSD": "ETCHALF/USD",
"ETCHEDGEUSD": "ETCHEDGE/USD",
"ETH-0325": "ETH-0325",
"ETH-1231": "ETH-1231",
"ETH-0624": "ETH-0624",
"ETH-PERP": "ETH-PERP",
"ETHBEARUSD": "ETHBEAR/USD",
"ETHBEARUSDT": "ETHBEAR/USDT",
@ -310,26 +318,29 @@ var symbolMap = map[string]string{
"ETHBTC": "ETH/BTC",
"ETHBULLUSD": "ETHBULL/USD",
"ETHBULLUSDT": "ETHBULL/USDT",
"ETHE-1231": "ETHE-1231",
"ETHE-0325": "ETHE-0325",
"ETHEUR": "ETH/EUR",
"ETHEUSD": "ETHE/USD",
"ETHHALFUSD": "ETHHALF/USD",
"ETHHEDGEUSD": "ETHHEDGE/USD",
"ETHUSD": "ETH/USD",
"ETHUSDT": "ETH/USDT",
"EURTEUR": "EURT/EUR",
"EURTUSD": "EURT/USD",
"EURTUSDT": "EURT/USDT",
"EURUSD": "EUR/USD",
"EXCH-1231": "EXCH-1231",
"EXCH-0325": "EXCH-0325",
"EXCH-PERP": "EXCH-PERP",
"EXCHBEARUSD": "EXCHBEAR/USD",
"EXCHBULLUSD": "EXCHBULL/USD",
"EXCHHALFUSD": "EXCHHALF/USD",
"EXCHHEDGEUSD": "EXCHHEDGE/USD",
"FB-1231": "FB-1231",
"FB-0325": "FB-0325",
"FBUSD": "FB/USD",
"FIDA-PERP": "FIDA-PERP",
"FIDAUSD": "FIDA/USD",
"FIDAUSDT": "FIDA/USDT",
"FIL-1231": "FIL-1231",
"FIL-0325": "FIL-0325",
"FIL-PERP": "FIL-PERP",
"FLM-PERP": "FLM-PERP",
"FLOW-PERP": "FLOW-PERP",
@ -344,23 +355,25 @@ var symbolMap = map[string]string{
"GALA-PERP": "GALA-PERP",
"GALAUSD": "GALA/USD",
"GALUSD": "GAL/USD",
"GARIUSD": "GARI/USD",
"GBPUSD": "GBP/USD",
"GBTC-1231": "GBTC-1231",
"GBTC-0325": "GBTC-0325",
"GBTCUSD": "GBTC/USD",
"GDX-1231": "GDX-1231",
"GDXJ-1231": "GDXJ-1231",
"GDX-0325": "GDX-0325",
"GDXJ-0325": "GDXJ-0325",
"GDXJUSD": "GDXJ/USD",
"GDXUSD": "GDX/USD",
"GENEUSD": "GENE/USD",
"GLD-1231": "GLD-1231",
"GLD-0325": "GLD-0325",
"GLDUSD": "GLD/USD",
"GLXYUSD": "GLXY/USD",
"GME-1231": "GME-1231",
"GME-0325": "GME-0325",
"GMEUSD": "GME/USD",
"GODSUSD": "GODS/USD",
"GOOGL-1231": "GOOGL-1231",
"GOGUSD": "GOG/USD",
"GOOGL-0325": "GOOGL-0325",
"GOOGLUSD": "GOOGL/USD",
"GRT-1231": "GRT-1231",
"GRT-0325": "GRT-0325",
"GRT-PERP": "GRT-PERP",
"GRTBEARUSD": "GRTBEAR/USD",
"GRTBULLUSD": "GRTBULL/USD",
@ -396,12 +409,16 @@ var symbolMap = map[string]string{
"IBVOLUSDT": "IBVOL/USDT",
"ICP-PERP": "ICP-PERP",
"ICX-PERP": "ICX-PERP",
"IMX-PERP": "IMX-PERP",
"IMXUSD": "IMX/USD",
"INTERUSD": "INTER/USD",
"IOTA-PERP": "IOTA-PERP",
"JETUSD": "JET/USD",
"JOEUSD": "JOE/USD",
"JSTUSD": "JST/USD",
"KAVA-PERP": "KAVA-PERP",
"KBTT-PERP": "KBTT-PERP",
"KBTTUSD": "KBTT/USD",
"KIN-PERP": "KIN-PERP",
"KINUSD": "KIN/USD",
"KNC-PERP": "KNC-PERP",
@ -416,6 +433,8 @@ var symbolMap = map[string]string{
"KSHIB-PERP": "KSHIB-PERP",
"KSHIBUSD": "KSHIB/USD",
"KSM-PERP": "KSM-PERP",
"KSOS-PERP": "KSOS-PERP",
"KSOSUSD": "KSOS/USD",
"LEO-PERP": "LEO-PERP",
"LEOBEARUSD": "LEOBEAR/USD",
"LEOBULLUSD": "LEOBULL/USD",
@ -424,7 +443,7 @@ var symbolMap = map[string]string{
"LEOUSD": "LEO/USD",
"LINA-PERP": "LINA-PERP",
"LINAUSD": "LINA/USD",
"LINK-1231": "LINK-1231",
"LINK-0325": "LINK-0325",
"LINK-PERP": "LINK-PERP",
"LINKBEARUSD": "LINKBEAR/USD",
"LINKBEARUSDT": "LINKBEAR/USDT",
@ -435,9 +454,11 @@ var symbolMap = map[string]string{
"LINKHEDGEUSD": "LINKHEDGE/USD",
"LINKUSD": "LINK/USD",
"LINKUSDT": "LINK/USDT",
"LOOKS-PERP": "LOOKS-PERP",
"LOOKSUSD": "LOOKS/USD",
"LRC-PERP": "LRC-PERP",
"LRCUSD": "LRC/USD",
"LTC-1231": "LTC-1231",
"LTC-0325": "LTC-0325",
"LTC-PERP": "LTC-PERP",
"LTCBEARUSD": "LTCBEAR/USD",
"LTCBEARUSDT": "LTCBEAR/USDT",
@ -451,6 +472,8 @@ var symbolMap = map[string]string{
"LUAUSD": "LUA/USD",
"LUAUSDT": "LUA/USDT",
"LUNA-PERP": "LUNA-PERP",
"LUNAUSD": "LUNA/USD",
"LUNAUSDT": "LUNA/USDT",
"MANA-PERP": "MANA-PERP",
"MANAUSD": "MANA/USD",
"MAPS-PERP": "MAPS-PERP",
@ -465,18 +488,20 @@ var symbolMap = map[string]string{
"MATICHALFUSD": "MATICHALF/USD",
"MATICHEDGEUSD": "MATICHEDGE/USD",
"MATICUSD": "MATIC/USD",
"MBSUSD": "MBS/USD",
"MCB-PERP": "MCB-PERP",
"MCBUSD": "MCB/USD",
"MEDIA-PERP": "MEDIA-PERP",
"MEDIAUSD": "MEDIA/USD",
"MER-PERP": "MER-PERP",
"MERUSD": "MER/USD",
"MID-1231": "MID-1231",
"MID-0325": "MID-0325",
"MID-PERP": "MID-PERP",
"MIDBEARUSD": "MIDBEAR/USD",
"MIDBULLUSD": "MIDBULL/USD",
"MIDHALFUSD": "MIDHALF/USD",
"MIDHEDGEUSD": "MIDHEDGE/USD",
"MINA-PERP": "MINA-PERP",
"MKR-PERP": "MKR-PERP",
"MKRBEARUSD": "MKRBEAR/USD",
"MKRBULLUSD": "MKRBULL/USD",
@ -486,10 +511,10 @@ var symbolMap = map[string]string{
"MNGOUSD": "MNGO/USD",
"MOBUSD": "MOB/USD",
"MOBUSDT": "MOB/USDT",
"MRNA-1231": "MRNA-1231",
"MRNA-0325": "MRNA-0325",
"MRNAUSD": "MRNA/USD",
"MSOLUSD": "MSOL/USD",
"MSTR-1231": "MSTR-1231",
"MSTR-0325": "MSTR-0325",
"MSTRUSD": "MSTR/USD",
"MTA-PERP": "MTA-PERP",
"MTAUSD": "MTA/USD",
@ -500,22 +525,23 @@ var symbolMap = map[string]string{
"MVDA25-PERP": "MVDA25-PERP",
"NEAR-PERP": "NEAR-PERP",
"NEO-PERP": "NEO-PERP",
"NFLX-1231": "NFLX-1231",
"NEXOUSD": "NEXO/USD",
"NFLX-0325": "NFLX-0325",
"NFLXUSD": "NFLX/USD",
"NIO-1231": "NIO-1231",
"NIO-0325": "NIO-0325",
"NIOUSD": "NIO/USD",
"NOK-1231": "NOK-1231",
"NOK-0325": "NOK-0325",
"NOKUSD": "NOK/USD",
"NVDA-1231": "NVDA-1231",
"NVDA-0325": "NVDA-0325",
"NVDAUSD": "NVDA/USD",
"OKB-1231": "OKB-1231",
"OKB-0325": "OKB-0325",
"OKB-PERP": "OKB-PERP",
"OKBBEARUSD": "OKBBEAR/USD",
"OKBBULLUSD": "OKBBULL/USD",
"OKBHALFUSD": "OKBHALF/USD",
"OKBHEDGEUSD": "OKBHEDGE/USD",
"OKBUSD": "OKB/USD",
"OMG-1231": "OMG-1231",
"OMG-0325": "OMG-0325",
"OMG-PERP": "OMG-PERP",
"OMGUSD": "OMG/USD",
"ONE-PERP": "ONE-PERP",
@ -532,16 +558,19 @@ var symbolMap = map[string]string{
"PAXGHEDGEUSD": "PAXGHEDGE/USD",
"PAXGUSD": "PAXG/USD",
"PAXGUSDT": "PAXG/USDT",
"PENN-1231": "PENN-1231",
"PENN-0325": "PENN-0325",
"PENNUSD": "PENN/USD",
"PEOPLE-PERP": "PEOPLE-PERP",
"PEOPLEUSD": "PEOPLE/USD",
"PERP-PERP": "PERP-PERP",
"PERPUSD": "PERP/USD",
"PFE-1231": "PFE-1231",
"PFE-0325": "PFE-0325",
"PFEUSD": "PFE/USD",
"POLIS-PERP": "POLIS-PERP",
"POLISUSD": "POLIS/USD",
"PORTUSD": "PORT/USD",
"PRIV-1231": "PRIV-1231",
"PRISMUSD": "PRISM/USD",
"PRIV-0325": "PRIV-0325",
"PRIV-PERP": "PRIV-PERP",
"PRIVBEARUSD": "PRIVBEAR/USD",
"PRIVBULLUSD": "PRIVBULL/USD",
@ -550,26 +579,31 @@ var symbolMap = map[string]string{
"PROM-PERP": "PROM-PERP",
"PROMUSD": "PROM/USD",
"PSGUSD": "PSG/USD",
"PSYUSD": "PSY/USD",
"PTUUSD": "PTU/USD",
"PUNDIX-PERP": "PUNDIX-PERP",
"PUNDIXUSD": "PUNDIX/USD",
"PYPL-1231": "PYPL-1231",
"PYPL-0325": "PYPL-0325",
"PYPLUSD": "PYPL/USD",
"QIUSD": "QI/USD",
"QTUM-PERP": "QTUM-PERP",
"RAMP-PERP": "RAMP-PERP",
"RAMPUSD": "RAMP/USD",
"RAY-PERP": "RAY-PERP",
"RAYUSD": "RAY/USD",
"REEF-1231": "REEF-1231",
"REALUSD": "REAL/USD",
"REEF-0325": "REEF-0325",
"REEF-PERP": "REEF-PERP",
"REEFUSD": "REEF/USD",
"REN-PERP": "REN-PERP",
"RENUSD": "REN/USD",
"RNDR-PERP": "RNDR-PERP",
"RNDRUSD": "RNDR/USD",
"RON-PERP": "RON-PERP",
"ROOK-PERP": "ROOK-PERP",
"ROOKUSD": "ROOK/USD",
"ROOKUSDT": "ROOK/USDT",
"ROSE-PERP": "ROSE-PERP",
"RSR-PERP": "RSR-PERP",
"RSRUSD": "RSR/USD",
"RUNE-PERP": "RUNE-PERP",
@ -578,11 +612,12 @@ var symbolMap = map[string]string{
"SAND-PERP": "SAND-PERP",
"SANDUSD": "SAND/USD",
"SC-PERP": "SC-PERP",
"SCRT-PERP": "SCRT-PERP",
"SECO-PERP": "SECO-PERP",
"SECOUSD": "SECO/USD",
"SHIB-PERP": "SHIB-PERP",
"SHIBUSD": "SHIB/USD",
"SHIT-1231": "SHIT-1231",
"SHIT-0325": "SHIT-0325",
"SHIT-PERP": "SHIT-PERP",
"SKL-PERP": "SKL-PERP",
"SKLUSD": "SKL/USD",
@ -590,21 +625,23 @@ var symbolMap = map[string]string{
"SLP-PERP": "SLP-PERP",
"SLPUSD": "SLP/USD",
"SLRSUSD": "SLRS/USD",
"SLV-1231": "SLV-1231",
"SLV-0325": "SLV-0325",
"SLVUSD": "SLV/USD",
"SNX-PERP": "SNX-PERP",
"SNXUSD": "SNX/USD",
"SNYUSD": "SNY/USD",
"SOL-1231": "SOL-1231",
"SOL-0325": "SOL-0325",
"SOL-PERP": "SOL-PERP",
"SOLBTC": "SOL/BTC",
"SOLUSD": "SOL/USD",
"SOLUSDT": "SOL/USDT",
"SOS-PERP": "SOS-PERP",
"SOSUSD": "SOS/USD",
"SPELL-PERP": "SPELL-PERP",
"SPELLUSD": "SPELL/USD",
"SPY-1231": "SPY-1231",
"SPY-0325": "SPY-0325",
"SPYUSD": "SPY/USD",
"SQ-1231": "SQ-1231",
"SQ-0325": "SQ-0325",
"SQUSD": "SQ/USD",
"SRM-PERP": "SRM-PERP",
"SRMUSD": "SRM/USD",
@ -621,14 +658,14 @@ var symbolMap = map[string]string{
"STSOLUSD": "STSOL/USD",
"STX-PERP": "STX-PERP",
"SUNUSD": "SUN/USD",
"SUSHI-1231": "SUSHI-1231",
"SUSHI-0325": "SUSHI-0325",
"SUSHI-PERP": "SUSHI-PERP",
"SUSHIBEARUSD": "SUSHIBEAR/USD",
"SUSHIBTC": "SUSHI/BTC",
"SUSHIBULLUSD": "SUSHIBULL/USD",
"SUSHIUSD": "SUSHI/USD",
"SUSHIUSDT": "SUSHI/USDT",
"SXP-1231": "SXP-1231",
"SXP-0325": "SXP-0325",
"SXP-PERP": "SXP-PERP",
"SXPBEARUSD": "SXPBEAR/USD",
"SXPBTC": "SXP/BTC",
@ -638,7 +675,7 @@ var symbolMap = map[string]string{
"SXPHEDGEUSD": "SXPHEDGE/USD",
"SXPUSD": "SXP/USD",
"SXPUSDT": "SXP/USDT",
"THETA-1231": "THETA-1231",
"THETA-0325": "THETA-0325",
"THETA-PERP": "THETA-PERP",
"THETABEARUSD": "THETABEAR/USD",
"THETABULLUSD": "THETABULL/USD",
@ -646,7 +683,7 @@ var symbolMap = map[string]string{
"THETAHEDGEUSD": "THETAHEDGE/USD",
"TLM-PERP": "TLM-PERP",
"TLMUSD": "TLM/USD",
"TLRY-1231": "TLRY-1231",
"TLRY-0325": "TLRY-0325",
"TLRYUSD": "TLRY/USD",
"TOMO-PERP": "TOMO-PERP",
"TOMOBEAR2021USD": "TOMOBEAR2021/USD",
@ -661,7 +698,7 @@ var symbolMap = map[string]string{
"TRUMP2024": "TRUMP2024",
"TRUUSD": "TRU/USD",
"TRUUSDT": "TRU/USDT",
"TRX-1231": "TRX-1231",
"TRX-0325": "TRX-0325",
"TRX-PERP": "TRX-PERP",
"TRXBEARUSD": "TRXBEAR/USD",
"TRXBTC": "TRX/BTC",
@ -676,38 +713,42 @@ var symbolMap = map[string]string{
"TRYBHALFUSD": "TRYBHALF/USD",
"TRYBHEDGEUSD": "TRYBHEDGE/USD",
"TRYBUSD": "TRYB/USD",
"TSLA-1231": "TSLA-1231",
"TSLA-0325": "TSLA-0325",
"TSLABTC": "TSLA/BTC",
"TSLADOGE": "TSLA/DOGE",
"TSLAUSD": "TSLA/USD",
"TSM-1231": "TSM-1231",
"TSM-0325": "TSM-0325",
"TSMUSD": "TSM/USD",
"TULIP-PERP": "TULIP-PERP",
"TULIPUSD": "TULIP/USD",
"TWTR-1231": "TWTR-1231",
"TWTR-0325": "TWTR-0325",
"TWTRUSD": "TWTR/USD",
"UBER-1231": "UBER-1231",
"UBER-0325": "UBER-0325",
"UBERUSD": "UBER/USD",
"UBXTUSD": "UBXT/USD",
"UBXTUSDT": "UBXT/USDT",
"UNI-1231": "UNI-1231",
"UMEEUSD": "UMEE/USD",
"UNI-0325": "UNI-0325",
"UNI-PERP": "UNI-PERP",
"UNIBTC": "UNI/BTC",
"UNISWAP-1231": "UNISWAP-1231",
"UNISWAP-0325": "UNISWAP-0325",
"UNISWAP-PERP": "UNISWAP-PERP",
"UNISWAPBEARUSD": "UNISWAPBEAR/USD",
"UNISWAPBULLUSD": "UNISWAPBULL/USD",
"UNIUSD": "UNI/USD",
"UNIUSDT": "UNI/USDT",
"USDT-1231": "USDT-1231",
"USDT-0325": "USDT-0325",
"USDT-PERP": "USDT-PERP",
"USDTBEARUSD": "USDTBEAR/USD",
"USDTBULLUSD": "USDTBULL/USD",
"USDTHALFUSD": "USDTHALF/USD",
"USDTHEDGEUSD": "USDTHEDGE/USD",
"USDTUSD": "USDT/USD",
"USO-1231": "USO-1231",
"USO-0325": "USO-0325",
"USOUSD": "USO/USD",
"UST-PERP": "UST-PERP",
"USTUSD": "UST/USD",
"USTUSDT": "UST/USDT",
"VET-PERP": "VET-PERP",
"VETBEARUSD": "VETBEAR/USD",
"VETBEARUSDT": "VETBEAR/USDT",
@ -715,7 +756,7 @@ var symbolMap = map[string]string{
"VETBULLUSDT": "VETBULL/USDT",
"VETHEDGEUSD": "VETHEDGE/USD",
"VGXUSD": "VGX/USD",
"WAVES-1231": "WAVES-1231",
"WAVES-0325": "WAVES-0325",
"WAVES-PERP": "WAVES-PERP",
"WAVESUSD": "WAVES/USD",
"WBTCBTC": "WBTC/BTC",
@ -723,8 +764,8 @@ var symbolMap = map[string]string{
"WNDRUSD": "WNDR/USD",
"WRXUSD": "WRX/USD",
"WRXUSDT": "WRX/USDT",
"WSB-1231": "WSB-1231",
"XAUT-1231": "XAUT-1231",
"WSB-0325": "WSB-0325",
"XAUT-0325": "XAUT-0325",
"XAUT-PERP": "XAUT-PERP",
"XAUTBEARUSD": "XAUTBEAR/USD",
"XAUTBULLUSD": "XAUTBULL/USD",
@ -737,7 +778,7 @@ var symbolMap = map[string]string{
"XLMBEARUSD": "XLMBEAR/USD",
"XLMBULLUSD": "XLMBULL/USD",
"XMR-PERP": "XMR-PERP",
"XRP-1231": "XRP-1231",
"XRP-0325": "XRP-0325",
"XRP-PERP": "XRP-PERP",
"XRPBEARUSD": "XRPBEAR/USD",
"XRPBEARUSDT": "XRPBEAR/USDT",
@ -748,7 +789,7 @@ var symbolMap = map[string]string{
"XRPHEDGEUSD": "XRPHEDGE/USD",
"XRPUSD": "XRP/USD",
"XRPUSDT": "XRP/USDT",
"XTZ-1231": "XTZ-1231",
"XTZ-0325": "XTZ-0325",
"XTZ-PERP": "XTZ-PERP",
"XTZBEARUSD": "XTZBEAR/USD",
"XTZBEARUSDT": "XTZBEAR/USDT",
@ -756,18 +797,19 @@ var symbolMap = map[string]string{
"XTZBULLUSDT": "XTZBULL/USDT",
"XTZHALFUSD": "XTZHALF/USD",
"XTZHEDGEUSD": "XTZHEDGE/USD",
"YFI-1231": "YFI-1231",
"YFI-0325": "YFI-0325",
"YFI-PERP": "YFI-PERP",
"YFIBTC": "YFI/BTC",
"YFII-PERP": "YFII-PERP",
"YFIIUSD": "YFII/USD",
"YFIUSD": "YFI/USD",
"YFIUSDT": "YFI/USDT",
"YGGUSD": "YGG/USD",
"ZEC-PERP": "ZEC-PERP",
"ZECBEARUSD": "ZECBEAR/USD",
"ZECBULLUSD": "ZECBULL/USD",
"ZIL-PERP": "ZIL-PERP",
"ZM-1231": "ZM-1231",
"ZM-0325": "ZM-0325",
"ZMUSD": "ZM/USD",
"ZRX-PERP": "ZRX-PERP",
"ZRXUSD": "ZRX/USD",