Comments (4)
Can you share your code please? And what does the example in the example xlsm do, does that work?
from crypto_vba.
The code in the example Coinbase sheet (ShtCoinbase) works as expected.
For my testing I have created a new Worksheet called CoinTest and have configured the following on it:
- Created a table named "Coin_Test"
- Added a named field/reference scoped to the worksheet called "apikey_coinbase" containing my API key
- Added a named field/reference scoped to the worksheet called "secretkey_coinbase" containing my secret key
I have also copied and modified the code from the original ShtCoinbase to the CoinTest and modified it as such
Sub GetTrans()
Dim JsonResponse As String
Dim Json As Object
'-> normally JSON is returned like {}, a dictionary in VBA,
'-> some functions return JSON is returned like [], a collection in VBA
'-> so to catch both, Dim Json as Object
Dim JsonRes As Dictionary
Dim apiKey As String
Dim secretKey As String
Set Sht = Worksheets("CoinTest")
Set Tb42 = Sht.ListObjects("Coin_Test")
'Put the credentials in a dictionary
apiKey = Sht.Range("apikey_coinbase").Value
secretKey = Sht.Range("secretkey_coinbase").Value
'Put the credentials in a dictionary
Dim Cred As New Dictionary
Cred.Add "apiKey", apiKey
Cred.Add "secretKey", secretKey
Dim Params As New Dictionary
Params.Add "CB-VERSION", "2005-05-05"
JsonResponse = PrivateCoinbase("accounts", "GET", Cred)
strToFile JsonResponse, "TestResponse", "json"
End Sub
The function strToFile
is just something simple I wrote that allows me to "dump" the JsonResponse to a file so I can see the output in Notepad++.
Running the above code as written results in the expected output with all of the account/wallet information in the JSON response as it does on the example ShtCoinbase.
Modifying the second to last line line in the following ways (based on the Coinbase API example) results in the following responses (Note: xxxxx-xx..... is a single hard coded asset/wallet id obtained from the output of the working accounts code)
JsonResponse = PrivateCoinbase("accounts//xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx//transactions", "GET", Cred)
- 401: HTTP-Unauthorized
JsonResponse = PrivateCoinbase("accounts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/transactions", "GET", Cred)
- 404: HTTP-Not Found
(The above aren't the only two things I have tried, but most have been some variation of the above)
from crypto_vba.
Hi there,
got around to testing it. This works for me:
Dim Params As New Dictionary
Params.Add "CB-VERSION", "2005-05-05"
JsonResponse = PrivateCoinbase("accounts/xxxxxxxxxxxxxxxxxxxxxxxxxxx/transactions", "GET", Cred, Params)
Note: you see that your credentials get added with the Cred parameter. The header CB-VERSION is passed as a Parameter.
Hope that helps. If so, please close the issue.
from crypto_vba.
No response, am closing the issue. Feel free to create a new issue if things don't work.
from crypto_vba.
Related Issues (20)
- Deribit, FTX HOT 1
- C_ARR_OHLCV on FORMULAS sheet updates on every workbook change HOT 6
- Trojan:Script/Oneeva.A!ml Windows Defender HOT 3
- CoinbasePro all fills HOT 1
- Can you add Uphold? HOT 1
- Definition of some functions HOT 4
- Error in Sub TestBitVavo() HOT 2
- How to Get Binance Withdraw History? HOT 3
- Add Celsius Wallet
- Place Buy/Sell order? HOT 7
- Woo x HOT 1
- Binance and OKEx errors. HOT 1
- coinbase error HOT 1
- Virus included in the download HOT 1
- how to add new crypto currencies (coinbase) HOT 1
- Cannot get Binance and Coinbase Pro to work in example sheet HOT 2
- can't download HOT 4
- Kucoin Api V2 HOT 1
- Kraken Api, place order HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crypto_vba.