Skip to content

Commit

Permalink
Use env var "BINANCE_API_URL" instead of harcoded url (#718)
Browse files Browse the repository at this point in the history
* Use api.binance

* Update url

* Fix

* Assign env var
  • Loading branch information
trizin authored Oct 5, 2023
1 parent 23549f0 commit efe1892
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:

dispense-active:
env:
BINANCE_API_URL: ${{secrets.BINANCE_API_URL}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
permissions:
contents: "read"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
BINANCE_API_URL: ${{secrets.BINANCE_API_URL}}

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion df_py/util/get_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def get_binance_rate_all(
@return
rate -- float or None -- target_currency_per_token. None if failure
"""
url = "https://data.binance.com/api/v3/klines"
url_base = os.getenv("BINANCE_API_URL", "https://api.binance.com")
url = url_base + "/api/v3/klines"
st_dt = datetime.fromtimestamp(timestr_to_timestamp(st))
fin_dt = datetime.fromtimestamp(timestr_to_timestamp(fin))
if st_dt > fin_dt:
Expand Down

0 comments on commit efe1892

Please sign in to comment.