-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb26182
commit 5db22bd
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import responses | ||
|
||
from datamaxi.binance import Binance as Client | ||
from tests.util import random_str | ||
from tests.util import mock_http_response | ||
from urllib.parse import urlencode | ||
|
||
|
||
mock_item = [ | ||
[ | ||
"Date", | ||
"Funding Rate", | ||
"Mark Price", | ||
], | ||
["07/03/2024 16:00:00", "0.00010000", "60178.96865957"], | ||
] | ||
|
||
key = random_str() | ||
client = Client(key) | ||
|
||
req_params = {"symbol": "BTC-USDT"} | ||
params = {"symbol": "BTC-USDT", "pandas": False} | ||
|
||
|
||
@mock_http_response( | ||
responses.GET, | ||
"/v1/raw/binance/funding-rate\\?" + urlencode(req_params), | ||
mock_item, | ||
200, | ||
) | ||
def test_binance_funding_rate(): | ||
"""Tests the API endpoint to get Binance funding rate.""" | ||
|
||
response = client.funding_rate(**params) | ||
response.should.equal(mock_item) |