没有合适的资源?快使用搜索试试~ 我知道了~
quantflying#strategies#三角套利-基础版1
需积分: 0 1 下载量 105 浏览量
2022-07-25
14:34:27
上传
评论
收藏 5KB MD 举报
温馨提示
试读
策略名称三角套利-基础版策略作者红色的雪from time import sleeptax = 0.0015 #交易费率,0.15%# 基础行情数据处理,根据传
资源推荐
资源详情
资源评论
> 策略名称
三角套利-基础版
> 策略作者
红色的雪
> 源码 (python)
``` python
#!python2
# -*- coding:utf-8 -*-
from time import sleep
Q3 = 0.5
tax = 0.0015 #交易费率,0.15%
class fmz_market():
# 基础行情数据处理,根据传入的交易对,获取数据,返回行情dict
def basic_data_handle(self, pair):
pair_depth = {'sale_volume': 0, 'sale_price': 0, 'buy_volume': 0, 'buy_price': 0}
depth = exchanges[pair].GetDepth()
asks_infor = depth.Asks[0]
bids_infor = depth.Bids[0]
pair_depth['sale_volume'] = asks_infor.Amount
pair_depth['sale_price'] = asks_infor.Price
pair_depth['buy_volume'] = bids_infor.Amount
pair_depth['buy_price'] = bids_infor.Price
#Log(pair_depth)
return pair_depth
#进行参数计算
def profit_calculation(self):
profit_obtain = 0
#先获取行情数据
P1_depth = self.basic_data_handle(0)
P2_depth = self.basic_data_handle(1)
P3_depth = self.basic_data_handle(2)
#买一价格整理
p1_sale_price =float(P1_depth['sale_price'])
p1_buy_price = float(P1_depth['buy_price'])
p2_sale_price = float(P2_depth['sale_price'])
p2_buy_price = float(P2_depth['buy_price'])
p3_sale_price = float(P3_depth['sale_price'])
p3_buy_price = float(P3_depth['buy_price'])
#深度数据整理
p1_sale_volume = fl
点击阅读更多
资源评论
俞林鑫
- 粉丝: 14
- 资源: 288
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功