sunny-order-splitter-python-sdk
安装
pip install sunny-order-splitter --upgrade
现货使用方式
测试网地址 : https://testnet.binance.vision
from sunny_order_splitter.binance_spot import SpotOrderSplitter
def main():
production = False # True正式环境,不传默认True
api_key = "EpcFiKyNEZ6GwpW4w1px60og0SYy0W4A2slX32UeH2hV9FjJfOdKPJDY9NNlbRrB"
secret_key = "OeIwlnfB0ImKdqTq4n4jLqYxdzYO87Lc8Mr2Z1bbCqraerpomMUJMD7EvtyIFFWh"
symbol = 'BTCUSDT'
sos = SpotOrderSplitter(symbol, api_key, secret_key, production)
# Call split_order method with test parameters
params = {
"side": "BUY",
"orderAmount": 90,
#"totalAmount": 100,
"percentTotalAmount": 80, # 总金额百分比
"interval": 2
}
"""
params = {
"side": "SELL",
"orderAmount": 1,
#"totalAmount": 100,
"percentTotalAmount": 100,
"interval": 2
}
"""
result = sos.split_order(params)
if result:
print(f"Orders placed successfully: {result['num_orders_success']} out of {result['num_orders']}")
print(f"Total quantity bought: {result['quantity']}")
else:
print("Failed to place orders.")
if __name__ == "__main__":
main()
合约使用方式(币本位)
现在只支持单项持仓,如果现在使用的是双向模式,会先改成单向模式
测试网地址: https://testnet.binancefuture.com
from sunny_order_splitter.binance_umfutures import UMFuturesOrderSplitter
def main():
production = False # Set to True for production
api_key = "63551008d09ed3a1d619644fbef3b27469b9518f0218c83e499843973e703146"
secret_key = "ae8a0dd6278350d19d796ceade26e7acf552b64178398a1dd9fb8f7191ccbddb"
symbol = 'BTCUSDT'
umfos = UMFuturesOrderSplitter(symbol, api_key, secret_key, production)
# Call split_order method with test parameters
params = {
"side": "SELL", # "BUY 多" or "SELL 空"
"orderAmount": 1000,
#"totalAmount": 200,
"percentTotalAmount": 20, # 总金额百分比
"leverage": 5, # 开仓杠杆 最大5倍
"interval": 5 # 间隔时间
}
#开仓
result = umfos.split_order(params)
if result:
print(f"Orders placed successfully: {result['num_orders_success']} out of {result['num_orders']}")
print(f"Total quantity bought: {result['quantity']}")
else:
print("Failed to place orders.")
#平仓
results_close_order = umfos.close_position()
if results_close_order:
print(f"Order closed successfully:{results_close_order['symbol']} {results_close_order['quantity']}")
else:
print("Failed to close order.")
if __name__ == "__main__":
main()
Metadata
Release files for sunny-order-splitter 0.2.3
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 |
|---|---|---|---|---|
| sunny_order_splitter-0.2.3.tar.gz | 5.9 kB | Without provenance | Details for sunny_order_splitter-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sunny_order_splitter-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for sunny_order_splitter-0.2.3-py3-none-any.whl |
Total release size: 14.6 kB
Release files / sunny_order_splitter-0.2.3.tar.gz
| Download URL | sunny_order_splitter-0.2.3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ddc16bcb4cef45c79c9b322fd587ed5aa5863bd5273bbd387d43111d8ac16f84
|
|
BLAKE2b-256 checksum How to use checksums |
e13cb5c989d08eb25ee58c2b591d1931a2055692d4303d4aae0d8c7f2591fe78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.3
|
Release files / sunny_order_splitter-0.2.3-py3-none-any.whl
| Download URL | sunny_order_splitter-0.2.3-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84887d36efabbf172b484302dbfc7b5212a032d10b70164237bd6d3161de4910
|
|
BLAKE2b-256 checksum How to use checksums |
4401ed082189cb5456565bd8d969660f39b014d1db40ca89251b4e0698b64b54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.3
|
Security for sunny-order-splitter 0.2.3
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.