量化交易策略:
量化策略是指使用计算机作为工具,通过一套固定的逻辑来分析、判断和决策。量化策略既可以自动执行,也可以人工执行;那么,一个完整的量化策略包含哪些内容?
一个完整的策略需要包含输入、策略处理逻辑、输出;策略处理逻辑需要考虑选股、择时、仓位管理和止盈止损等因素,市场是千变万化的,需要实时监控策略的有效性。
The contract tracking software development system can be divided into independent tracking/built-in tracking systems;
1.Independent order tracking system:that is,through API docking,traders(experts with trading experience)enter the exchange,attracting more users to follow and place orders,thereby earning profits;In addition,the applicability/stability requirements for APIs are relatively high;
2.Built-in tracking system:operate on your own platform;The advantage lies in bringing a new model for exchanges to attract users;Regardless of whether it is an exchange or a documentary platform,the returns will be higher compared to others;
合约跟单需要完全同步,他买你同时卖、他卖你同时买,人工跟单/手动跟单,情绪受到市场环境各方面的影响,从而造成判断上的失误,而系统能够更好按照制定好的策略来执行,
合约跟单系统的功能,搭建数字货币合约跟单,大致包括以下几点:
1.交易员,跟随交易员下单,Traders can obtain additional income;
2.高并发系统,纯下单可以支持千万级TPS每秒;此外,还包括交易过程还包括撮合/清算,其中清算最为耗时,对系统的稳定性考验相对性较大;
3.可实现多实盘帐号对交易子帐号同时进行的正向、反向、多倍跟单效果;
4.高可用的备用系统,与主系统架构完全一致,若瞬间流量过高造成网络线路故障,可在几分钟之内切换到备用系统;
5.对单个交易员设置不同的合约保证金和交易手续费;风险管理设置;
6.API限额,是系统过载时的自我稳定保护机制;
7.实发布交易实时风险信息;
8.随时查看相关记录;
9.API对接多个,用户可以自主选择交易员/平台;
是一个PPQ量化的入口脚本,将你的模型和数据按要求进行打包:
This file will show you how to quantize your network with PPQ
You should prepare your model and calibration dataset as follow:
~/working/model.onnx<--your model
~/working/data/.npy or~/working/data/.bin<--your dataset
if you are using caffe model:
~/working/model.caffemdoel<--your model
~/working/model.prototext<--your model
###MAKE SURE YOUR INPUT LAYOUT IS[N,C,H,W]or[C,H,W]###
quantized model will be generated at:~/working/quantized.onnx
"""
from ppq import*
from ppq.api import*
import os
#modify configuration below:
WORKING_DIRECTORY='working'#choose your working directory
TARGET_PLATFORM=TargetPlatform.PPL_CUDA_INT8#choose your target platform
MODEL_TYPE=NetworkFramework.ONNX#or NetworkFramework.CAFFE
INPUT_LAYOUT='chw'#input data layout,chw or hwc
NETWORK_INPUTSHAPE=[1,3,224,224]#input shape of your network
CALIBRATION_BATCHSIZE=16#batchsize of calibration dataset
EXECUTING_DEVICE='cuda'#'cuda'or'cpu'.
REQUIRE_ANALYSE=False
DUMP_RESULT=False#是否需要Finetuning一下你的网络
#SETTING对象用于控制PPQ的量化逻辑
#当你的网络量化误差过高时,你需要修改SETTING对象中的参数进行特定的优化
SETTING=UnbelievableUserFriendlyQuantizationSetting(
platform=TARGET_PLATFORM,finetune_steps=2500,
finetune_lr=1e-3,calibration='kl',#【改】量化算法可选'kl','pecentile','mse'
equalization=True,non_quantable_op=None)
SETTING=SETTING.convert_to_daddy_setting()
print('正准备量化你的网络,检查下列设置:')
print(f'WORKING DIRECTORY:{WORKING_DIRECTORY}')
print(f'TARGET PLATFORM:{TARGET_PLATFORM.name}')
print(f'NETWORK INPUTSHAPE:{NETWORK_INPUTSHAPE}')
print(f'CALIBRATION BATCHSIZE:{CALIBRATION_BATCHSIZE}')