Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you get the current position info for future account? #634

Closed
Sailendrakc opened this issue Jun 18, 2023 · 1 comment
Closed

How do you get the current position info for future account? #634

Sailendrakc opened this issue Jun 18, 2023 · 1 comment

Comments

@Sailendrakc
Copy link

Sailendrakc commented Jun 18, 2023

This is more of a question at this point. I was trying to get the information about current position I am in and there are no any existing methods for it. There is one websocket method called "futureUser" which logs all the activities.

const futuresUser = await client.ws.futuresUser(msg => {
  console.log(msg)
});

But this will only fire if i open or close a position and there is some change in position. I wont be able to retrive my current position with this.

Any workaround or suggestion would be helpful.

@Sailendrakc
Copy link
Author

Found the solution.

There is a function called "futuresAccountInfo()". It will have all the information.
It is not in the docs but there are lot of other helpful functions when you look in actual code. I found this function inside
http-client.js as this query was more http request related than websocket related.

Usage:

let res = await client.futuresAccountInfo();
console.log(res); // res.positions has all available position of every pairs. It will have lof of empty positions, 
//just filter for pairs you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant