Get OHLCV/klines/candlesticks data from binance.
Project description
binance-ohlcv
Get OHLCV data from binance.
Installation
Install latest release from PyPI:
pip install binance-ohlcv
Or install latest commit from the github repository:
pip install git+https://github.com/decotra/binance-ohlcv
Usage
import binance_ohlcv as bo
from datetime import date
df1 = bo.get_spot(symbol='BTCUSDT', timeframe='1s', start=date(2023, 1, 1), end=date(2023, 1, 2))
df2 = bo.get_futures_um(symbol='BTCUSDT', timeframe='1m', start=date(2023, 1, 1), end=date(2023, 1, 2))
df3 = bo.get_futures_cm(symbol='BTCUSD_PERP', timeframe='1m', start=date(2023, 1, 1), end=date(2023, 1, 2))
print(df1)
print(df2)
print(df3)
Output:
open high low close volume
timestamp
2023-01-01 00:00:00+00:00 16541.77 16543.20 16541.73 16542.37 2.03879
2023-01-01 00:00:01+00:00 16541.90 16542.40 16541.55 16542.16 2.34046
2023-01-01 00:00:02+00:00 16542.16 16542.18 16541.56 16541.62 0.46549
2023-01-01 00:00:03+00:00 16542.12 16542.37 16541.56 16541.78 1.55876
2023-01-01 00:00:04+00:00 16541.79 16542.26 16541.39 16541.95 2.26832
... ... ... ... ... ...
2023-01-02 23:59:55+00:00 16675.08 16675.28 16674.57 16674.58 2.41974
2023-01-02 23:59:56+00:00 16674.58 16674.58 16673.54 16673.57 1.66548
2023-01-02 23:59:57+00:00 16673.53 16673.87 16673.45 16673.53 0.15998
2023-01-02 23:59:58+00:00 16673.52 16673.52 16672.91 16673.26 2.41843
2023-01-02 23:59:59+00:00 16672.86 16673.13 16672.39 16672.87 3.18091
[172800 rows x 5 columns]
open high low close volume
timestamp
2023-01-01 00:00:00+00:00 16537.5 16538.0 16534.3 16538.0 170.576
2023-01-01 00:01:00+00:00 16538.0 16538.0 16534.9 16534.9 44.287
2023-01-01 00:02:00+00:00 16534.9 16535.0 16531.3 16531.4 100.228
2023-01-01 00:03:00+00:00 16531.4 16531.4 16526.6 16526.9 317.879
2023-01-01 00:04:00+00:00 16527.0 16529.3 16523.0 16529.2 211.281
... ... ... ... ... ...
2023-01-02 23:55:00+00:00 16672.7 16672.7 16650.0 16665.1 1879.831
2023-01-02 23:56:00+00:00 16665.2 16666.9 16663.6 16663.6 181.900
2023-01-02 23:57:00+00:00 16663.7 16668.5 16663.6 16666.9 156.172
2023-01-02 23:58:00+00:00 16666.8 16668.0 16666.8 16667.9 115.988
2023-01-02 23:59:00+00:00 16668.0 16668.0 16665.9 16666.0 146.532
[2880 rows x 5 columns]
open high low close volume
timestamp
2023-01-01 00:00:00+00:00 16531.2 16531.2 16531.1 16531.1 132
2023-01-01 00:01:00+00:00 16531.1 16531.2 16531.1 16531.1 333
2023-01-01 00:02:00+00:00 16531.1 16531.1 16528.0 16528.0 4254
2023-01-01 00:03:00+00:00 16528.1 16528.1 16524.4 16524.5 4589
2023-01-01 00:04:00+00:00 16524.5 16524.5 16521.6 16521.7 3141
... ... ... ... ... ...
2023-01-02 23:55:00+00:00 16667.5 16667.6 16650.0 16660.4 31447
2023-01-02 23:56:00+00:00 16660.3 16660.4 16660.3 16660.4 1434
2023-01-02 23:57:00+00:00 16660.4 16661.6 16660.4 16661.6 2441
2023-01-02 23:58:00+00:00 16661.6 16661.6 16661.5 16661.6 316
2023-01-02 23:59:00+00:00 16661.6 16661.6 16661.5 16661.6 888
[2880 rows x 5 columns]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
binance_ohlcv-0.0.3.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file binance_ohlcv-0.0.3.tar.gz
.
File metadata
- Download URL: binance_ohlcv-0.0.3.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.10.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1498501626ea155933de4511b0ddde1b7d053eaf0437893af2617ae0a9e6ce34 |
|
MD5 | 6519b174d962b8e4fdaca4541bf85c59 |
|
BLAKE2b-256 | 049963df69362ba7dd93aabc8c58b40b46c796dbbe8e4f86e9c0eb4058d2d0e3 |
File details
Details for the file binance_ohlcv-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: binance_ohlcv-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.10.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6935a56ac282539be7239464b2832918f23ea39cd7431e339ab9024550108510 |
|
MD5 | e0ff2935fc2fda2d7ba061ae86ae8e43 |
|
BLAKE2b-256 | e5bbc2d490718c5539942ae306df872b401bb8a6f3a9448465b03596b2bc666d |