Liberal Alpha Python SDK for interacting with gRPC-based backend
Project description
📖 使用示例 (中文) 1️⃣ 初始化 SDK 你可以使用默认参数初始化:
from liberal_alpha import initialize, liberal
initialize() 或者使用自定义参数:
initialize(host="127.0.0.1", port=8128) 2️⃣ 发送数据
JSON_Object = { "Price": 100000, "Volume": 50, "Volume_USD": 5000000, }
liberal.send_data("BTC_SOURCE1", JSON_Object, record_id="1") 3️⃣ 发送 Alpha 信号
alpha_data = { "signal": "buy", "confidence": 0.85 }
liberal.send_alpha("Alpha_ID", alpha_data, record_id="1") 4️⃣ 订阅数据 如果你需要实时订阅数据,请使用 subscribe_data 方法。请确保你已经在网站的 订阅频道 (Subscribe Channel) 中订阅了你感兴趣的记录。
liberal.subscribe_data( api_key="YOUR_API_KEY", base_url="http://your-backend-url", private_key="YOUR_PRIVATE_KEY", # 可选,用于解密消息 record_id=1, # 订阅特定记录(不传则订阅所有已订阅记录) max_reconnect=5 ) 请确保你的 API Key 和私钥正确无误,并且已在网站的订阅频道中订阅了所需的数据。
📖 Usage Example (English) 1️⃣ Initialize the SDK You can initialize the SDK using default parameters:
from liberal_alpha import initialize, liberal
initialize() Or customize the parameters:
initialize(host="127.0.0.1", port=8128) 2️⃣ Send Data
JSON_Object = { "Price": 100000, "Volume": 50, "Volume_USD": 5000000, }
liberal.send_data("BTC_SOURCE1", JSON_Object, record_id="1") 3️⃣ Send Alpha Signal
alpha_data = { "signal": "buy", "confidence": 0.85 }
liberal.send_alpha("Alpha_ID", alpha_data, record_id="1") 4️⃣ Subscribe to Data If you need to subscribe to real-time data, use the subscribe_data method. Make sure you have subscribed to the desired records via the website's Subscribe Channel.
liberal.subscribe_data( api_key="YOUR_API_KEY", base_url="http://your-backend-url", private_key="YOUR_PRIVATE_KEY", # Optional, used for decrypting messages record_id=1, # Subscribe to a specific record; omit to subscribe to all subscribed records max_reconnect=5 ) Ensure that your API Key and private key are correct, and that you have subscribed to the data you wish to receive in the website's subscribe channel.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liberal_alpha-0.1.4.tar.gz.
File metadata
- Download URL: liberal_alpha-0.1.4.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
332f00553fbe4da8c1e9c73e36c22dfe7f8abefb2487fa36a3fa3a9272d766b1
|
|
| MD5 |
f110d3d5926817dbd634d60e10c2baec
|
|
| BLAKE2b-256 |
9dd03e79d3fb05c7260687768f3f3673666b4bb4814a07a700affff702ded772
|
File details
Details for the file liberal_alpha-0.1.4-py3-none-any.whl.
File metadata
- Download URL: liberal_alpha-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2c278b266b8786da6ecf757f770e7baf6ca032f981e71eee26a30ab241c283f
|
|
| MD5 |
562462c73e625f680eab36636e0ef26d
|
|
| BLAKE2b-256 |
bfaf921e1458eff31b65cddc0b6469d52ba18b701a7709fb46f897582dfc9b02
|