예제 #1
0
from captain.controlled import controlled_name_type, ControlledName
from captain.lib.controlled_types import Tif
priceSession = Manager().getPriceSession()
orderSession = Manager().getOrderFillSession()
allCustDefaults = Manager().getCustomers()
custDefaults = allCustDefaults[0]
ordSrv = Manager().getOrderServer()
priceSrv = Manager().getPriceServer()
product_list = [
    "MCH",
]
products = priceSession.getProducts(prodName=product_list[0],
                                    prodType=aenums.TT_PROD_FUTURE)
product = products[0]
contracts = priceSession.getContracts(products, contractKeys=[
    "397224",
])
contract = contracts[0]
pricey = None
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 "OPEN_PRC" in str(enum):
        pricey = price.value

if pricey is None:
    pricey = 300

orderParams = dict(
예제 #2
0
from pyrate.ttapi.predicates import CallbackType
from pyrate.ttapi.manager import Manager
from pyrate.ttapi.order import TTAPIOrder
from ttapi import aenums, cppclient
from pyrate.exceptions import TimeoutError
from captain.controlled import controlled_name_type, ControlledName
from captain.lib.controlled_types import Tif
priceSession = Manager().getPriceSession()
orderSession = Manager().getOrderFillSession()
allCustDefaults = Manager().getCustomers()
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):
예제 #3
0
priceSession = Manager().getPriceSession()
orderSession = Manager().getOrderFillSession()
allCustDefaults = Manager().getCustomers()
ordSrv = Manager().getOrderServer()
priceSrv = Manager().getPriceServer()
products = priceSession.getProducts(prodName='CN',
                                    prodType=aenums.TT_PROD_FUTURE)
custDefaults = allCustDefaults[0]
while True:
    for product in products:
        pricey = None
        found_price = None
        if "STOCK" not in str(product.prod_type):
            if "FUTURE" not in str(product.prod_type):
                pricey = 3
            contracts = priceSession.getContracts(
                product, contractKeys=["CNM18", "CNN18"])
            for contract in contracts:
                for enum, price in priceSession.getPrices(contract).items():
                    if "SETTL" in str(enum):
                        found_price = price.value
                    elif "LAST_TRD_PRC" in str(enum):
                        found_price = price.value
                    elif "OPEN_PRC" in str(enum):
                        found_price = price.value
                    if "SRS_STATUS" in str(enum):
                        trading_status = price.value
                pricey = 100 if found_price is None and "HKEx" in priceSession.exchangeName else found_price
                if pricey is not None and trading_status != 6:
                    for side in [aenums.TT_SELL, aenums.TT_BUY]:
                        depth_level = 1
                        pricey = 100 if found_price is None and "HKEx" in priceSession.exchangeName else found_price
예제 #4
0
import time
import pyscreenshot
from pyrate.ttapi.manager import Manager
from pyrate.ttapi.order import TTAPIOrder
from ttapi import aenums, cppclient
priceSession = Manager().getPriceSession()
orderSession = Manager().getOrderFillSession()
allCustDefaults = Manager().getCustomers()
ordSrv = Manager().getOrderServer()
priceSrv = Manager().getPriceServer()
products = priceSession.getProducts(prodName='JGBM',
                                    prodType=aenums.TT_PROD_FUTURE)
product = products[0]
contracts = priceSession.getContracts(
    product)  #, contractKeys="FUT_NK225M_1704")
contract = contracts[2]
custDefaults = allCustDefaults[-1]
run_now = True
prev_trading_status = None
curr_trading_status = None
pricey = None
while run_now is True:
    time.sleep(5)
    try:
        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 "OPEN_PRC" in str(enum):
                pricey = price.value
예제 #5
0
from ttapi import aenums, cppclient
from ttapi.client.type_converters import date2_ttDate
from captain.controlled import controlled_name_type, ControlledName
from captain.lib.controlled_types import Tif
priceSession = Manager().getPriceSession()
orderSession = Manager().getOrderFillSession()
custDefaults = Manager().getCustomer()
ordSrv = Manager().getOrderServer()
priceSrv = Manager().getPriceServer()
tiffies = ('GTD', 'GTC', 'GTDATE')  # 'GIS')#, 'FOK')
restr = (None, aenums.TT_FOK_ORDER_RES, aenums.TT_IOC_ORDER_RES)
products = priceSession.getProducts(prodType=aenums.TT_PROD_FUTURE,
                                    prodName="EY")
time.sleep(60)
for product in products:
    contracts = priceSession.getContracts(
        product, contractKeys=["EYZ18", "EYH19", "EYM19"])
    for contract in contracts:
        settlement_price = None
        for enum, price in priceSession.getPrices(contract).items():
            if "SETTL" in str(enum):
                settlement_price = price.value
        if settlement_price is None:
            if "FUTURE" in str(product):
                settlement_price = 100
            elif "OPTION" in str(product):
                settlement_price = 15
            else:
                settlement_price = 15
        pricey = settlement_price
        for tiffy in tiffies:
            restriction = None
예제 #6
0



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(" "):
예제 #7
0
from pyrate.ttapi.order import TTAPIOrder
from ttapi import aenums, cppclient
priceSession = Manager().getPriceSession()
orderSession = Manager().getOrderFillSession()
allCustDefaults = Manager().getCustomers()
custDefaults = allCustDefaults[-1]
ordSrv = Manager().getOrderServer()
priceSrv = Manager().getPriceServer()
max_detailed_depth = 3
prev_trading_status = None
curr_trading_status = None
pricey = 20600
products = priceSession.getProducts(prodName='NK',
                                    prodType=aenums.TT_PROD_FUTURE)
product = products[0]
contracts = priceSession.getContracts(product, contractKeys=["NKN19", "NKQ19"])
while True:
    while curr_trading_status == prev_trading_status:
        for contract in contracts:
            try:
                for enum, price in priceSession.getPrices(contract).items():
                    if "SRS_STATUS" in str(enum):
                        curr_trading_status = price.value
            except:
                pass
        time.sleep(15)
    orderSession.deleteMyOrders()
    for contract in contracts:
        try:
            for enum, price in priceSession.getPrices(contract).items():
                if "SETTL" in str(enum):