python 期货现货差价监测_Python期货期权无风险套利监控升级版

代码基于天勤量化平台,先贴出完整代码:

#!/usr/bin/env python

# -*- coding: utf-8 -*-

#import asyncio

from tqsdk import TqApi, TqAuth

from contextlib import closing

from time import time

# 创建API实例.

api = TqApi(auth=TqAuth("天勤账号", "账号密码"))

async def taoli(Call='',Put='',Lr=3, Dlr=1): #默认3跳,1跳对手价平仓损耗,1跳抹除手续费,1跳纯利润

quote_C = api.get_quote(Call)

quote_P = api.get_quote(Put)

futer = quote_C.underlying_symbol

quote_F = api.get_quote(futer)

async with api.register_update_notify([quote_C,quote_P,quote_F]) as update_chan: #

async for _ in update_chan: #

D_time = (quote_C.last_exercise_datetime-time()) * Lr / (Dlr*86400)

if quote_C.exercise_type == 'A':

lr = quote_F.price_tick * Lr #行权盈利点数

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值