"""
|
卖票相关类
|
"""
|
# 获取卖价
|
from utils import tool
|
|
|
def get_sell_price(price_type, limit_up_price, limit_down_price, current_price):
|
price = None
|
if price_type == 0:
|
if not current_price:
|
raise Exception("没有获取到L1现价")
|
price = tool.get_buy_min_price(current_price)
|
if limit_down_price and price < round(float(limit_down_price), 2):
|
price = round(float(limit_down_price), 2)
|
elif price_type == 1:
|
if not limit_down_price:
|
raise Exception("没有获取到跌停价")
|
price = round(float(limit_down_price), 2)
|
elif price_type == 2:
|
|
if not limit_up_price:
|
raise Exception("没有获取到涨停价")
|
price = round(float(limit_up_price), 2)
|
elif price_type == 3:
|
if not current_price:
|
raise Exception("没有获取到L1现价")
|
price = current_price
|
elif price_type == 4:
|
if not current_price:
|
raise Exception("没有获取到L1现价")
|
price = round(float(current_price) - 0.05, 2)
|
else:
|
raise Exception("价格类型错误")
|
return price
|