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

Minor update #5

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.PHONY: format
.PHONY: format, test
format:
@echo "Formatting code..."
isort .
black .
black .

test:
@echo "Running tests..."
python3 -m unittest discover -v
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pip3 install .
This SDK uses the Coinbase Cloud API keys. To use this SDK, you will need to create a Coinbase Cloud API key and secret. You can do this by following the instructions [here](https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#cloud-api-keys).
Make sure to save your API key and secret in a safe place. You will not be able to retrieve your secret again.

WARNING: We do not recommend that you save your API secrets directly in your code outside of testing purposes. Best practice is to use a secrets manager and access your secrets that way. You should be careful about exposing your secrets publicly if posting code that leverages this library.

Optional: Set your API key and secret in your environment (make sure to put these in quotation marks). For example:
```bash
export COINBASE_API_KEY="organizations/{org_id}/apiKeys/{key_id}"
Expand All @@ -31,13 +33,14 @@ If you did not set your API key and secret in your environment, you can pass the
```python
from coinbase.rest import RESTClient

client = RESTClient(api_key="<YOUR_API_KEY>", api_secret="<YOUR_API_SECRET>")
api_key = "organizations/{org_id}/apiKeys/{key_id}"
api_secret = "-----BEGIN EC PRIVATE KEY-----\nYOUR PRIVATE KEY\n-----END EC PRIVATE KEY-----\n"

client = RESTClient(api_key=api_key, api_secret=api_secret)
```
You can also set a timeout in seconds for your REST requests like so:
```python
from coinbase.rest import RESTClient

client = RESTClient(api_key="<YOUR_API_KEY>", api_secret="<YOUR_API_SECRET>", timeout=5)
client = RESTClient(api_key=api_key, api_secret=api_secret, timeout=5)
```

### Using the Client
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requests
black>=23.3.0
isort>=5.11.5
cryptography>=41.0.5
PyJWT>=2.8.0
requests==2.31.0
black==23.3.0
isort==5.12.0
cryptography==41.0.5
PyJWT==2.8.0
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests-mock
requests-mock==1.11.0