h2zee
h2zee

Reputation: 1

Bybit ccxt Futures, demo and spot trading

I want to use ccxt to open and close futures, spot orders.

when I was using this object to open trades on futures, it was opening it on spot.

bybit = ccxt.bybit({
    "apiKey": setting['API'],  # Use dictionary access
    "secret": setting['SECRET'],
    "enableRateLimit": True,
    "version": 'v5',
    "options": {
        "defaultType": "futures", 

    }
})

then i found that i should use linear. and I tried it for Demo trading with this object.

bybit = ccxt.bybit({
    "apiKey": setting['API'],  # Use dictionary access
    "secret": setting['SECRET'],
    "enableRateLimit": True,
    "version": 'v5',
    "options": {
        "defaultType": "spot",  # swap or "future"
        "trade.type": "linear"  # for USDT perpetual futures

    }
})
if setting['Demo']:
    bybit.enable_demo_trading(True)

now its showing this error ccxt.base.errors.AuthenticationError: bybit {"retCode":10003,"retMsg":"API key is invalid.","result":{},"retExtInfo":{},"time":1733744704733}

can someone help me fix this so i can test it on demo, testnet, futures(real) and spot(real) accounts?

Upvotes: 0

Views: 356

Answers (0)

Related Questions