API Reference
These docs are for v2.0. Click to read the latest docs for v2.0.1.

/userPosition

Retrieves user current open position on the exchange

Client Library

import { BluefinClient, Networks, MARKET_SYMBOLS } from "@bluefin-exchange/bluefin-v2-client";

async function main() {
  const dummyAccountKey =
    "trigger swim reunion gate hen black real deer light nature trial dust";
  const client = new BluefinClient(
    true,
    Networks.TESTNET_SUI,
    dummyAccountKey,
    "ED25519"
  );
  await client.init();

  // fetch only BTC-PERP position
  const resp = await client.getUserPosition({ symbol: MARKET_SYMBOLS.BTC });
  console.log(resp.data);
}

main().then().catch(console.warn);
from config import TEST_ACCT_KEY, TEST_NETWORK
from bluefin_v2_client import BluefinClient, Networks, MARKET_SYMBOLS, TRADE_TYPE, Interval
from pprint import pprint
import asyncio
    
async def main():

    client = BluefinClient(True, Networks[TEST_NETWORK], TEST_ACCT_KEY)
    await client.init(True)

    # gets user current position in a specified Market

    position = await client.get_user_position({"symbol":MARKET_SYMBOLS.ETH})
    pprint(position)

    # to retrieve all currently opened positions call the function without the symbol: client.get_user_position({})


    await client.close_connections()

if __name__ == "__main__":
  loop = asyncio.new_event_loop()
  loop.run_until_complete(main())
  loop.close()

HTTPs

Alternatively, if you have obtained your auth token, call the GET /userPosition endpoint using the integrated editor on the right or locally from any language supporting HTTPs network calls.

Request & Response

Language
Credentials
Bearer
JWT
Click Try It! to start a request and see the response here!