Giter Club home page Giter Club logo

Comments (6)

krijnsent avatar krijnsent commented on May 29, 2024

Hi @ITJusus

do check out the current example with the current code (I updated it over the past months). For Binance this is the API documentation:
https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md
For openorders they give:
GET /api/v3/openOrders (HMAC SHA256)

So in VBA code that would be (make sure your api key is in Cred, like the examples in the file):
Dim ParamsT As New Dictionary
ParamsT.Add "timestamp", GetBinanceTime()
JsonResult = PrivateBinance("openOrders", "GET", Cred, ParamsT)

That should give you back your open orders.

Does that help?
Cheers,
Koen

from crypto_vba.

ITJusus avatar ITJusus commented on May 29, 2024

Yes, thank you. I'll give it a shot.

from crypto_vba.

ITJusus avatar ITJusus commented on May 29, 2024

Hello again. I'm trying to work my way through this, but I seem to be getting stuck.

When I run the following, I get a nice clean plethora of values between { }...
Debug.Print PrivateBinance("account", "GET", Cred, ParamsT)

When I run the openorders equivalent, I just get an empty [ ]...
Debug.Print PrivateBinance("openOrders", "GET", Cred, ParamsT)

Am I just not able to print an array and that's why this is happening? Or do you know if I'm doing something else wrong? I know I have 3 open orders currently. But it just comes back with [ ].

from crypto_vba.

krijnsent avatar krijnsent commented on May 29, 2024

Hi there,
okay, maybe the following helps:
-make sure the API key has the proper rights (might require trade permission)
-you could try "allOrders" instead, that requires a symbol

Dim ParamsT As New Dictionary
ParamsT.Add "timestamp", GetBinanceTime()
ParamsT.Add "symbol", "LTCBTC"
JsonResult = PrivateBinance("allOrders", "GET", Cred, ParamsT)

-try either "order" or "openOrders" with a symbol (all variations are in the Binance API docs)

The data that is returned is JSON, but it is also simply text, the next steps of the code transform that text into something that you can loop through etc. So a debug.print should give you the whole reply (no hidden parts of an array). Hope any of those options work?

from crypto_vba.

ITJusus avatar ITJusus commented on May 29, 2024

Thank you for the sage advice.

I was at least able to get some progress. When I add a specif symbol to the ParamsT and then utilize "allOrders"...I actually get results back.

Debug.Print PrivateBinance("allOrders", "GET", Cred, ParamsT)

Unfortunately, when I try the same, except changing "allOrders" to "openOrders"...it just returns [ ]. No data.

Debug.Print PrivateBinance("openOrders", "GET", Cred, ParamsT)

So, it's able to pull my order history (allOrders) but not my currently active orders (openOrders). Odd.

I did try replacing "openOrders" with "orders" and "order", but it just fails with the following error in either case...

{"error_nr":404,"error_txt":"HTTP-Not Found","response_txt":0}

I do have trading enabled in my api key. I've also been reading through the Binance API page and trying different options much of the day yesterday.

Problem with using "allOrders" is it pulls all active, cancelled, or filled orders...and only for 1 symbol. Since I really only want to know what orders (trades) I currently have open for any symbols...this would be much more difficult to use to try to grab only the data I need.

The "openOrders" would hit the spot, but it just doesn't seem to want to work. Crazy I can just replace "openOrders" with "allOrders" and I do get results. What does that isolate to be the problem then, is what I'm trying to figure out now.

from crypto_vba.

krijnsent avatar krijnsent commented on May 29, 2024

Hi there,
did you update the ModWeb module, as I improved the way the code processes the feedback the API gives?
I'm not actively using Binance, so have no orders nor coins to test, but these are my results:

allOrders: {"error_nr":400,"error_txt":"HTTP-Bad Request","response_txt":{"code":-1121,"msg":"Invalid symbol."}}
openOrders: []
order: {"error_nr":400,"error_txt":"HTTP-Bad Request","response_txt":{"code":-1102,"msg":"Mandatory parameter 'symbol' was not sent, was empty/null, or malformed."}}

That should help you finding out which parameters the API needs/expects. Otherwise you might want to ask around in their Telegram API group: https://t.me/binance_api_english

Cheers

from crypto_vba.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.