Administrator
3 天以前 5f034f7a6733b03e0d08d7920ec6de1b1517c421
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
卖票相关类
"""
# 获取卖价
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