question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

deribit.fetchPositions return []

See original GitHub issue

CCXT version:‘1.66.54’

<script type="text/javascript" src="https://unpkg.com/ccxt"></script>
<script>
deribit=new ccxt.deribit()
//set API key
deribit.fetchPositions()
//return []
</script>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rainssongcommented, Jan 9, 2022

this bug happens in line 67806

the response is in different strcture

image

maybe change line 67852 const result = this.parsePositions (response); to const result = this.parsePositions (response.result);

will fix this

0reactions
rainssongcommented, Jan 9, 2022

it works and looks properer

in version 1.6610, the result is like:

[
    {
        "vega": "0.0",
        "total_profit_loss": "0.0",
        "theta": "0.0",
        "size": "0.0",
        "settlement_price": "0.00832017",
        "realized_profit_loss": "0.000064034",
        "open_orders_margin": "0.0",
        "mark_price": "0.00718766",
        "maintenance_margin": "0.0",
        "kind": "option",
        "instrument_name": "BTC-14JAN22-45000-C",
        "initial_margin": "0.0",
        "index_price": "41999.38",
        "gamma": "0.0",
        "floating_profit_loss_usd": "0.0",
        "floating_profit_loss": "0.0",
        "direction": "zero",
        "delta": "0.0",
        "average_price_usd": "0.0",
        "average_price": "0.0"
    }
]

and now 1.66.57

[
    {
        "info": {
            "vega": "0.0",
            "total_profit_loss": "0.0",
            "theta": "0.0",
            "size": "0.0",
            "settlement_price": "0.00832017",
            "realized_profit_loss": "0.000064034",
            "open_orders_margin": "0.0",
            "mark_price": "0.00706313",
            "maintenance_margin": "0.0",
            "kind": "option",
            "instrument_name": "BTC-14JAN22-45000-C",
            "initial_margin": "0.0",
            "index_price": "41964.66",
            "gamma": "0.0",
            "floating_profit_loss_usd": "0.0",
            "floating_profit_loss": "0.0",
            "direction": "zero",
            "delta": "0.0",
            "average_price_usd": "0.0",
            "average_price": "0.0"
        },
        "symbol": "BTC/BTC:BTC-220114:45000:call",
        "timestamp": 1641698051502,
        "datetime": "2022-01-09T03:14:11.502Z",
        "initialMargin": 0,
        "maintenanceMargin": 0,
        "maintenanceMarginPercentage": 0,
        "entryPrice": "0.0",
        "notional": 0,
        "unrealizedPnl": 0,
        "contracts": 0,
        "contractSize": 1,
        "markPrice": "0.00706313",
        "side": "zero"
    }
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Deribit API
Deribit provides three different interfaces to access the API: JSON-RPC over Websocket ... state, false, string, Will be passed back in the response....
Read more >
Exchanges — ccxt 2.4.71 documentation
The ccxt library is a collection of available crypto exchanges or exchange classes. Each class implements the public and private API for a...
Read more >
How to close position on binance futures. My thoughts - CITAF
If you have opened a futures position via a futures exchange, ... Automate trading at OKX, Bybit, Binance, Bitfinex, Deribit & BitMEX from...
Read more >
Newest 'ccxt' Questions - Stack Overflow
Ccxt binance fetchOHLCV doesn't return last data. I am using ccxt library for binance ... fetchPositions(symbols = 'SOL/USDT:USDT', params = {}) I get...
Read more >
Deribit - An Introductory API Guide - AlgoTrading101 Blog
Deribit is an online cryptocurrency derivatives exchange that focuses on cryptocurrency futures and options trading. What is Deribit API? Derbit API is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found