krijnsent / crypto_vba

An Excel/VBA project to communicate with various cryptocurrency exchanges APIs
MIT License
157 stars 54 forks source link

Kraken Api, place order #89

Open hammerjoe opened 9 months ago

hammerjoe commented 9 months ago

I am trying to create a limit order but I am getting the error EGeneral:Invalid arguments:ordertype and I cant figure it out.

This is the code to make the call Dim Params as Dictionary Order_Type = "limit" Trade_Type = "sell" new_volume_pair = 0.01 Params.Add "apiKey", Apikey Params.Add "secretKey", secretKey Params.Add "ordertype", Order_Type Params.Add "type", Trade_Type Params.Add "volume", new_volume_pair Params.Add "price", token_price response = PrivateKraken("AddOrder", "POST", Params)

What am I getting the error about the ordertype??

hammerjoe commented 9 months ago

For those that had the same issue here is the solution:

Need to provide two dictionaries to the call.

Cred.Add "apiKey", Apikey Cred.Add "secretKey", secretKey Params.Add "ordertype", Order_Type Params.Add "type", LCase(Trade_Type) Params.Add "volume", new_volume_pair Params.Add "price", token_price Params.Add "nonce", CStr((CLng(Now) * 1000)) response = PrivateKraken("AddOrder", "POST", Cred, Params)