Administrator
2024-07-25 9d39b293bde97f31f522010373aad1dd3f654c07
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
36
37
38
from code_attribute import target_codes_manager
from log_module import log_export
from utils import tool, l2_huaxin_util
 
 
def get_cb_code(code):
    return target_codes_manager.get_cb_code(code)
 
 
def load_market_info():
    markets = log_export.load_market_info()
    codes = set()
    for code in markets:
        for m in markets[code]:
            if m[0].find("30") == 0 and m[2] > 0.09:
                codes.add(m[0])
 
 
if __name__ == "__main__":
    code = '118010'
    __latest_transaction_price_dict ={code:[(10.77, 9305865), (10.77, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.76, 9305865), (10.78, 9305908), (10.78, 9305910), (10.78, 9305931), (10.79, 9310049), (10.8, 9310049), (10.8, 9310049), (10.8, 9310049), (10.83, 9310049), (10.83, 9310049), (10.8, 9310212), (10.8, 9310220), (10.83, 9310257), (10.83, 9310259), (10.83, 9310259), (10.83, 9310272), (10.83, 9310291), (10.83, 9310291), (10.82, 9310359), (10.83, 9310372), (10.83, 9310372), (10.83, 9310397), (10.83, 9310460), (10.83, 9310460), (10.82, 9310460), (10.82, 9310460), (10.82, 9310460), (10.82, 9310460), (10.82, 9310460), (10.82, 9310460), (10.82, 9310460), (10.81, 9310460), (10.81, 9310463), (10.8, 9310463), (10.8, 9310463), (10.8, 9310463), (10.8, 9310463), (10.86, 9310465), (10.89, 9310465), (10.81, 9310489), (10.81, 9310489), (10.81, 9310489), (10.8, 9310489), (10.79, 9310489), (10.79, 9310489), (10.79, 9310489), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.79, 9310492), (10.81, 9310501), (10.81, 9310599), (10.81, 9310599), (10.8, 9310608), (10.89, 9310751), (10.89, 9310757), (10.89, 9310757), (10.89, 9310844), (10.89, 9310844), (10.89, 9310844), (10.89, 9310866), (10.89, 9310868), (10.87, 9310870), (10.87, 9310870), (10.87, 9310892), (10.88, 9310953), (10.88, 9310955), (10.88, 9310958), (10.88, 9310963), (10.89, 9311049), (10.89, 9311076), (10.89, 9311087), (10.88, 9311087), (10.88, 9311089), (10.88, 9311089), (10.89, 9311112), (10.9, 9311143), (10.9, 9311143), (10.9, 9311143), (10.9, 9311143), (10.9, 9311164), (10.92, 9311250), (10.92, 9311250), (10.92, 9311250), (10.92, 9311250), (10.92, 9311250), (10.93, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.92, 9311314), (10.93, 9311338), (10.92, 9311338), (10.93, 9311381), (10.93, 9311420), (10.92, 9311420), (10.93, 9311442), (10.93, 9311442), (10.93, 9311491), (10.92, 9311491), (10.95, 9311536), (10.93, 9311552), (10.95, 9311552), (10.95, 9311552), (10.93, 9311552), (10.93, 9311552), (10.93, 9311552), (10.95, 9311602), (10.93, 9311619), (10.93, 9311652), (10.92, 9311652), (10.92, 9311670), (10.94, 9311708), (10.94, 9311708), (10.97, 9311708), (10.97, 9311708), (10.97, 9311714), (10.97, 9311738), (10.97, 9311742), (10.97, 9311745), (10.97, 9311846), (10.98, 9311848), (10.98, 9311848), (10.98, 9311848), (10.98, 9311868), (10.97, 9311870), (10.97, 9311870), (10.97, 9311870), (10.97, 9311870), (10.97, 9311870), (10.97, 9311870), (10.97, 9311870), (10.97, 9311870), (10.98, 9311873), (10.97, 9311873), (10.95, 9311933), (10.92, 9311933), (10.96, 9311937), (10.97, 9311937), (10.97, 9311937), (10.97, 9311937), (10.98, 9311937), (10.98, 9311937), (10.92, 9311942), (10.92, 9311942), (10.92, 9311942), (10.92, 9311942), (10.92, 9311942), (10.92, 9311945), (10.98, 9312004), (10.98, 9312004), (10.98, 9312004), (10.99, 9312004), (10.99, 9312004), (10.99, 9312004), (10.99, 9312004), (11.0, 9312004), (11.0, 9312004), (10.93, 9312015), (10.98, 9312145), (10.95, 9312149), (10.95, 9312149), (10.95, 9312149), (10.95, 9312149), (10.95, 9312170), (10.95, 9312170), (10.93, 9312251), (10.93, 9312285), (10.93, 9312285), (10.94, 9312291), (10.94, 9312291), (10.94, 9312305), (10.95, 9312305), (10.95, 9312305), (10.95, 9312305), (10.98, 9312305), (10.98, 9312305), (10.98, 9312305), (10.98, 9312305), (10.98, 9312305), (10.98, 9312305), (10.98, 9312305), (10.98, 9312308), (10.98, 9312314), (10.98, 9312314), (10.98, 9312314), (10.98, 9312314), (10.98, 9312323), (10.98, 9312323), (10.99, 9312323), (10.99, 9312323), (10.98, 9312337), (10.98, 9312456), (11.0, 9312490), (11.0, 9312501), (11.0, 9312513), (10.98, 9312513), (10.99, 9312538), (10.99, 9312538), (10.99, 9312547), (10.99, 9312581), (10.98, 9312581), (11.0, 9312672), (11.0, 9312740), (10.99, 9312748), (10.99, 9312748), (10.99, 9312748), (11.0, 9312750), (11.0, 9312750), (10.99, 9312750), (10.99, 9312753), (10.99, 9312753), (10.99, 9312753), (11.0, 9312822), (10.99, 9312840), (10.99, 9312840), (10.99, 9312840), (10.99, 9312840), (11.0, 9312840), (11.0, 9312840), (11.0, 9312916), (11.0, 9312916), (11.0, 9312916), (11.0, 9312916), (11.0, 9312916), (11.0, 9312916), (11.0, 9312916), (11.01, 9312971), (11.0, 9312971), (10.99, 9312971), (10.99, 9312971), (11.02, 9313030), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313050), (11.04, 9313053), (11.04, 9313053), (11.04, 9313053), (11.04, 9313053), (11.04, 9313056), (11.04, 9313056), (11.04, 9313056), (11.02, 9313056), (11.01, 9313056), (11.0, 9313056), (11.0, 9313056), (11.04, 9313100), (11.04, 9313100), (11.05, 9313100), (11.01, 9313118), (11.01, 9313132), (11.0, 9313132), (11.04, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.05, 9313132), (11.01, 9313169), (11.01, 9313169), (11.01, 9313189), (11.01, 9313197), (11.01, 9313197), (11.04, 9313248), (11.04, 9313351), (11.04, 9313351), (11.04, 9313351), (11.05, 9313354), (11.04, 9313354), (11.04, 9313364), (11.04, 9313364), (11.04, 9313380), (11.04, 9313481), (11.04, 9313488), (11.04, 9313488), (11.05, 9313533), (11.06, 9313649), (11.05, 9313678), (11.04, 9313690), (11.04, 9313690), (11.04, 9313695), (11.04, 9313695), (11.03, 9313733), (11.03, 9313733), (11.03, 9313733), (11.03, 9313733), (11.03, 9313733), (11.03, 9313733), (11.03, 9313733), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.03, 9313740), (11.0, 9313776), (11.0, 9313776), (11.0, 9313776), (11.0, 9313776), (11.0, 9313776), (11.0, 9313779)]}
 
    if code not in __latest_transaction_price_dict:
        __latest_transaction_price_dict[code] = []
 
    time_space = 2000
 
    while True:
        end_time, start_time = __latest_transaction_price_dict[code][-1][1], \
                               __latest_transaction_price_dict[code][0][1]
        if tool.trade_time_sub_with_ms(l2_huaxin_util.convert_time(end_time, with_ms=True),
                                       l2_huaxin_util.convert_time(start_time, with_ms=True)) <= time_space:
            break
        else:
            if __latest_transaction_price_dict[code]:
                # 删除第一个元素
                __latest_transaction_price_dict[code].pop(0)
    print(__latest_transaction_price_dict[code][-1][0] - __latest_transaction_price_dict[code][0][0], f"{__latest_transaction_price_dict[code]}")