QWDataAPI
QWDataAPI is a powerful cryptocurrency market data fetching tool that provides high-quality historical and alternative data from Quantweb3.ai.
Features ✨
- 🚀 High-performance data retrieval
- 📊 Minute-level candlestick data
- 💫 Support for major exchanges
- 🔄 Asynchronous processing for large datasets
- 📈 Complete market depth information
Quick Start 🚀
Installation
pip install qwdataapi
Basic Usage
from qwdataapi import auth, fetch_data
- Authentication (Get credentials at https://quantweb3.ai/subscribe)
auth('your_username', 'your_token')
- Fetch Data
df = fetch_data(
symbol='BTCUSDT', # Trading pair
start='2024-01-01 00:00:00' # Start time
)
- View Data
print(df.head())
Advanced Usage
Fetch data with custom parameters
df = fetch_data(
symbol='BTCUSDT', # Trading pair
exchange='binance', # Exchange
asset_type='spot', # Asset type: spot/futures
start='2024-01-01 00:00:00', # Start time
end='2024-01-02 00:00:00', # End time
batch_size=50 # Batch size
)
Function Parameters 📋
- exchange (
str): The name of the exchange, defaults to'binance'. - symbol (
str): The trading pair, for example'BTCUSDT', defaults to'BTCUSDT'. - asset_type (
str): The type of asset. Defaults to'spot'for spot trading.'coinm'represents coin-based futures trading, while'usdm'represents USD-based futures trading. - data_type (
str): The type of data. Defaults to'klines', which represents candlestick data. - start (
str): The start time of the data, formatted as'YYYY-MM-DD HH:MM:SS', defaults to'2023-08-01 00:00:00'. - end (
str): The end time of the data, formatted the same as the start time, defaults to'2024-07-17 00:00:00'. - batch_size (
int): The size of the data batch for each request, a number between 40 and 100, defaults to 50.
Save data
df.to_csv('btc_data.csv')
Data Structure 📊
The returned DataFrame contains the following columns:
| Column | Description |
|---|---|
| open_time | Opening time (index) |
| open | Opening price |
| high | Highest price |
| low | Lowest price |
| close | Closing price |
| volume | Trading volume |
| close_time | Closing time |
| quote_volume | Quote currency volume |
| count | Number of trades |
| taker_buy_volume | Taker buy volume |
| taker_buy_quote_volume | Taker buy quote volume |
Authentication 🔑
- Visit Quantweb3.ai Subscription Page(Note: New users get a 7-day free trial)
- Register and obtain authentication credentials
- Use the
auth()function to authenticate
How to get free data service?
Note: Open an account using one of the above links and provide a screenshot to get 1 year's of free data service(Anyone).
Examples 📝
You can view the demo on Google Colab by clicking here.
Fetch Bitcoin Daily Data and Plot
import pandas as pd
import matplotlib.pyplot as plt
from qwdataapi import auth, fetch_data
Authenticate
auth('your_username', 'your_token')
Fetch data
Fetch data
df = fetch_data(
symbol='BTCUSDT',
start='2024-01-01',
end='2024-01-07'
)
Plot price chart
plt.figure(figsize=(15, 7))
plt.plot(df.index, df['close'])
plt.title('BTC/USDT Price')
plt.xlabel('Time')
plt.ylabel('Price')
plt.grid(True)
plt.show()
Dependencies 📦
- python-snappy >= 0.7.2
- grpcio >= 1.64.1
- pandas >= 1.5.3
- protobuf >= 4.25.3
- tqdm >= 4.65.0
FAQ ❓
Q: How to handle authentication errors?
A: Ensure your username and token are correct, and check your network connection.
Q: What is the data update frequency?
A: Hstorical data is updated daily.
Contributing 🤝
Issues and Pull Requests are welcome!
License 📄
This project is licensed under the MIT License - see the LICENSE file for details
Contact 📧
- Website: quantweb3.ai
- Email: quantweb3.ai@gmail.com
- X: https://x.com/quantweb3_ai
- Telegram: https://t.me/+6e2MtXxoibM2Yzlk
Changelog 📝
Metadata
Release files for qwdataapi 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qwdataapi-1.0.8.tar.gz | 11.4 kB | Without provenance | Details for qwdataapi-1.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qwdataapi-1.0.8-py3-none-any.whl | Python 3 | none | any | Details for qwdataapi-1.0.8-py3-none-any.whl |
Total release size: 21.1 kB
Release files / qwdataapi-1.0.8.tar.gz
| Download URL | qwdataapi-1.0.8.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42b97c9e7b24b1f04c7c02a8e25b6dd62d5236d05ed84577c450de35a79bc967
|
|
BLAKE2b-256 checksum How to use checksums |
3db60f5cb09835383c0ab1e0d5fc14780a1b0a79761fb86c2fed94e27e6c9619
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / qwdataapi-1.0.8-py3-none-any.whl
| Download URL | qwdataapi-1.0.8-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d984e0d249116766a4d698d07cfb0850374eaa49a2483242bed7b6044a12bf19
|
|
BLAKE2b-256 checksum How to use checksums |
4d0df8f46b716539f7bad1c62179fa15bd98703a966203ecf65234cd04ae3481
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for qwdataapi 1.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.