コード例 #1
0
ordSrv = Manager().getOrderServer()
priceSrv = Manager().getPriceServer()
products = priceSession.getProducts(prodName='HSI',
                                    prodType=aenums.TT_PROD_FUTURE)
product = products[0]
contracts = priceSession.getContracts(product)
contract = contracts[3]
custDefaults = allCustDefaults[0]
run_now = True
prev_trading_status = None
curr_trading_status = None
pricey = None
while run_now is True:
    try:
        if not priceSession.feed_down:
            for enum, price in priceSession.getPrices(contract).items():
                if "SETTL" in str(enum):
                    pricey = price.value
                elif "LAST_TRD_PRC" in str(enum):
                    pricey = price.value
                elif "SRS_STATUS" in str(enum):
                    curr_trading_status = price.value
            if curr_trading_status == prev_trading_status:
                pass
            else:
                orderSession.deleteMyOrders()
                if "FUTURE" not in str(product.prod_type) and pricey is None:
                    pricey = 10
                if pricey is None:
                    pricey = 30000
                else:
コード例 #2
0
ファイル: useful_shit.py プロジェクト: chrismaurer/chrism
import time
import pyscreenshot
from pyrate.ttapi.manager import Manager
priceSession = Manager().getPriceSession()
priceSrv = Manager().getPriceServer()

while True:
   if time.localtime()[3] == 7 and time.localtime()[4] in range(0, 5):
       pyscreenshot.grab_to_file(r"C:\tt\screenshot_start_subscribe_" + "-".join([str(time.localtime()[3]), str(time.localtime()[4]), str(time.localtime()[5])]) + ".png")
       products = priceSession.getProducts()
       for product in products:
           contracts = priceSession.getContracts(product)
           for contract in contracts:
               print contract
               pricedata = priceSession.getPrices(contract, timeout=90)
       pyscreenshot.grab_to_file(r"C:\tt\screenshot_end_subscribe_" + "-".join([str(time.localtime()[3]), str(time.localtime()[4]), str(time.localtime()[5])]) + ".png")
   time.sleep(360)

python
f = open(r'/var/log/debesys/OC_ose.log', 'r')
all_client_ips = []
for line in f.readlines():
    exid, uexid, exectype, client_ip = None, None, None, None
    date = " ".join(line.split(" ")[0:1])
    if date == "2020-06-16":
        if "MaurDC-Ko" in line and "SEGMENT" not in line and "Account.name" not in line and "CUSTOMER_DEFAULTS" not in line:
            for elem in line.split(" "):
                if elem.startswith("client_ip"):
                    client_ip = elem.split("=")[-1].replace("\"", "")
                    client_ip = client_ip.replace("\n", "")