Skip to content
Bark edited this page Nov 14, 2020 · 5 revisions

Welcome to the evolving wiki !

API

  • evolving.evolving.Service: start and stop THS client

    • isClientLoggedIn()
    • loginClient()
    • logoutClient()
    • reLoginClient()
  • evolving.evolving.Evolving: trading module

    • isBrokerLoggedIn()
    • loginBroker()
    • logoutBroker()
    • getAccountInfo()
    • transfer(transferType = "bank2broker", amount = 100000)
    • transfer_bank2broker(amount = 100000)
    • transfer_broker2bank(amount = 100000)
    • getTransferRecords(dateRange = "thisWeek")
    • getAssetType(stockCode)
    • getBids(stockCode = "600030", assetType = None)
    • issuingEntrust(stockCode, amount, price = None, tradingAction = 'buy', assetType = None)
    • buy(stockCode, amount, price = None)
    • sell(stockCode, amount, price = None)
    • buyStock(stockCode, amount, price = None)
    • sellStock(stockCode, amount, price = None)
    • buySciTech(stockCode, amount, price = None)
    • sellSciTech(stockCode, amount, price = None)
    • buyGem(stockCode, amount, price = None)
    • sellGem(stockCode, amount, price = None)
    • getTodayIPO()
    • oneKeyIPO()
    • revokeEntrust(revokeType = "allBuyAndSell", assetType = "stock", contractNo = None)
    • revokeAllBuyEntrust()
    • revokeAllSellEntrust()
    • revokeAllEntrust()
    • revokeContractNoEntrust(assetType = "stock", contractNo = "N8743678")
    • getHoldingShares(assetType = 'stock')
    • getAllHoldingShares()
    • getEntrust(assetType = 'stock', dateRange = 'today', isRevocable = True)
    • getTodayAllRevocableEntrust()
    • getClosedDeals(assetType = 'stock', dateRange = 'today')
    • getCapitalDetails(assetType = 'stock', dateRange = 'thisSeason')
    • getIPO(queryType = "entrust", dateRange = "today")
    • getIPOentrust(dateRange = "today")
    • getIPOallotmentNo(dateRange = "today")
    • getIPOwinningLots(dateRange = "today")
    • liquidating()
    • entrustPortfolio(StockCodeAmountPriceList = [])
  • evolving.evolving.EvolvingSim: simulation trading module

    • getAccountInfo()
    • issuingEntrust(stockCode, amount, price = None, tradingAction = 'buy')
    • buy(stockCode, amount, price = None)
    • sell(stockCode, amount, price = None)
    • revokeEntrust(revokeType = "allBuyAndSell", contractNo = None)
    • getHoldingShares()
    • getEntrust(dateRange = 'today', isRevocable = True)
    • getClosedDeals(dateRange = 'today')
    • getCapitalDetails(dateRange = 'thisSeason')
    • liquidating()
    • entrustPortfolio(stockCodeAmountPriceList = [])

Get start with evolving

  • evolving.evolving.Service
import evolving.evolving as evo
import time
from pprint import pprint as show

s = evo.Service()
e = evo.Evolving()
es = evo.EvolvingSim()


status = s.loginClient()
show(status)
time.sleep(1)

status = s.isClientLoggedIn()
show(status)
time.sleep(1)

status = s.logoutClient()
show(status)
time.sleep(1)

status = s.isClientLoggedIn()
show(status)
time.sleep(1)

status = s.reLoginClient()
show(status)
time.sleep(1)

status = s.logoutClient()
show(status)
  • evolving.evolving.Evolving
import evolving.evolving as evo
import time
from pprint import pprint as show

s = evo.Service()
e = evo.Evolving()
es = evo.EvolvingSim()


status = s.loginClient()
show(status)

e.keepInformed = True

status = e.isBrokerLoggedIn()
show(status)

status = e.loginBroker()
show(status)

status = e.isBrokerLoggedIn()
show(status)

accountInfo = e.getAccountInfo()
show(accountInfo)

status = e.transfer(transferType = "broker2bank", amount = 1000)
show(status)

status = e.transfer(transferType = "bank2broker", amount = 1000)
show(status)

status = e.transfer_broker2bank(amount = 10000)
show(status)

status = e.transfer_bank2broker(amount = 10000)
show(status)

transferRecords = e.getTransferRecords(dateRange = "thisYear")
show(transferRecords)

bids = e.getBids(stockCode = "600030")
show(bids)

bids = e.getBids(stockCode = "600030", assetType = 'stock')
show(bids)

bids = e.getBids(stockCode = "688055")
show(bids)
bids = e.getBids(stockCode = "688055", assetType = 'sciTech')
show(bids)

bids = e.getBids(stockCode = "300750", assetType = 'gem')
show(bids)
bids = e.getBids(stockCode = "300750")
show(bids)

status, contractNo = e.issuingEntrust(stockCode = '002241', amount = 100, price = 37.01, tradingAction = 'buy')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '002241', amount = 100, price = 40.01, tradingAction = 'sell')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '002241', amount = 100, tradingAction = 'buy')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '002241', amount = 100, tradingAction = 'sell')
show(status)
show(contractNo)

status, contractNo = e.issuingEntrust(stockCode = '688050', amount = 200, price = 220.01, tradingAction = 'buy')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '688050', amount = 200, price = 225.01, tradingAction = 'sell')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '688050', amount = 200, tradingAction = 'buy')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '688050', amount = 200, tradingAction = 'sell')
show(status)
show(contractNo)

status, contractNo = e.issuingEntrust(stockCode = '300474', amount = 200, price = 72.54, tradingAction = 'buy')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '300474', amount = 200, price = 78.41, tradingAction = 'sell')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '300474', amount = 200, tradingAction = 'buy')
show(status)
show(contractNo)
status, contractNo = e.issuingEntrust(stockCode = '300474', amount = 200, tradingAction = 'sell')
show(status)
show(contractNo)

status, contractNo = e.buy(stockCode = '002241', amount = 100)
show(status)
show(contractNo)
status, contractNo = e.buy(stockCode = '002241', amount = 100, price = 37.01)
show(status)
show(contractNo)
status, contractNo = e.buy(stockCode = '688050', amount = 200, price = 220.01)
show(status)
show(contractNo)
status, contractNo = e.buy(stockCode = '300474', amount = 200, price = 72.54)
show(status)
show(contractNo)

status, contractNo = e.sell(stockCode = '002241', amount = 100)
show(status)
show(contractNo)
status, contractNo = e.sell(stockCode = '002241', amount = 100, price = 37.01)
show(status)
show(contractNo)
status, contractNo = e.sell(stockCode = '688050', amount = 200, price = 220.01)
show(status)
show(contractNo)
status, contractNo = e.sell(stockCode = '300474', amount = 200, price = 72.54)
show(status)
show(contractNo)

status, contractNo = e.buyStock(stockCode = '002241', amount = 100, price = 37.01)
show(status)
show(contractNo)
status, contractNo = e.sellStock(stockCode = '002241', amount = 100, price = 40.01)
show(status)
show(contractNo)
status, contractNo = e.buyStock(stockCode = '002241', amount = 100)
show(status)
show(contractNo)
status, contractNo = e.sellStock(stockCode = '002241', amount = 100)
show(status)
show(contractNo)

status, contractNo = e.buySciTech(stockCode = '688050', amount = 200, price = 225.01)
show(status)
show(contractNo)
status, contractNo = e.sellSciTech(stockCode = '688050', amount = 200, price = 220.01)
show(status)
show(contractNo)
status, contractNo = e.buySciTech(stockCode = '688050', amount = 200)
show(status)
show(contractNo)
status, contractNo = e.sellSciTech(stockCode = '688050', amount = 200)
show(status)
show(contractNo)

status, contractNo = e.buyGem(stockCode = '300474', amount = 200, price = 72.54)
show(status)
show(contractNo)
status, contractNo = e.sellGem(stockCode = '300474', amount = 200, price = 78.41)
show(status)
show(contractNo)
status, contractNo = e.buyGem(stockCode = '300474', amount = 200)
show(status)
show(contractNo)
status, contractNo = e.sellGem(stockCode = '300474', amount = 200)
show(status)
show(contractNo)

todayIPO = e.getTodayIPO()
show(todayIPO)

status = e.oneKeyIPO()
show(status)

status = e.revokeEntrust(revokeType = "allBuyAndSell", assetType = "stock", contractNo = None)
show(status)
status = e.revokeEntrust(revokeType = "allBuy", assetType = "stock", contractNo = None)
show(status)
status = e.revokeEntrust(revokeType = "allSell", assetType = "stock", contractNo = None)
show(status)

status = e.revokeContractNoEntrust(assetType = "stock",  contractNo = "N8536587")
show(status)

status = e.revokeAllEntrust()
show(status)
status = e.revokeAllBuyEntrust()
show(status)
status = e.revokeAllSellEntrust()
show(status)

holdingShares = e.getHoldingShares(assetType = 'stock')
show(holdingShares)

allholdingShares = e.getAllHoldingShares()
show(allholdingShares)

entrust = e.getEntrust(assetType = 'stock', dateRange = 'today', isRevocable = True)
show(entrust)

entrust = e.getEntrust(assetType = 'stock', dateRange = 'today', isRevocable = False)
show(entrust)

entrust = e.getEntrust(assetType = 'stock', dateRange = 'thisWeek', isRevocable = False)
show(entrust)
show(len(entrust.get('data')))

entrust = e.getEntrust(assetType = 'stock', dateRange = 'thisYear', isRevocable = False)
show(entrust)

res = e.getTodayAllRevocableEntrust()
show(res)

closedDeals = e.getClosedDeals(assetType = 'stock', dateRange = 'thisSeason')
show(closedDeals)

closedDeals = e.getClosedDeals(assetType = 'stock', dateRange = 'today')
show(closedDeals)

capitalDetails = e.getCapitalDetails(assetType = 'stock', dateRange = 'thisSeason')
show(capitalDetails)

capitalDetails = e.getCapitalDetails(assetType = 'stock', dateRange = 'today')
show(capitalDetails)

res = e.getIPO(queryType = "entrust", dateRange = "today")

res = e.getIPO(queryType = "allotmentNo", dateRange = "thisMonth")
show(res)

res = e.getIPO(queryType = "winningLots", dateRange = "thisSeason")
show(res)

status = e.liquidating()
show(status)

StockCodeAmountPriceList = [['512290', '1000', '2.169'], ['512290', '1000', '2.171'], ['688050', '200', '225.01']]
statusList = e.entrustPortfolio(StockCodeAmountPriceList)
show(statusList)
status = e.revokeAllEntrust()
show(status)

status = s.logoutClient()
show(status)
  • evolving.evolving.EvolvingSim
import evolving.evolving as evo
import time
from pprint import pprint as show

s = evo.Service()
e = evo.Evolving()
es = evo.EvolvingSim()

status = s.loginClient()
show(status)
time.sleep(3)

simulationAccountInfo = es.getAccountInfo()
show(simulationAccountInfo)

status, cevosimractNo = es.issuingEntrust(stockCode = '002241', amount = 100, price = 37.01, tradingAction = 'buy')
show(status)
show(contractNo)
status, cevosimractNo = es.issuingEntrust(stockCode = '600196', amount = 100, price = 60.01, tradingAction = 'buy')
show(status)
show(contractNo)
status, cevosimractNo = es.issuingEntrust(stockCode = '600196', amount = 100, tradingAction = 'buy')
show(status)
show(contractNo)
status, cevosimractNo = es.issuingEntrust(stockCode = '600196', amount = 100, price = 61.81, tradingAction = 'sell')
show(status)
show(contractNo)
status, cevosimractNo = es.issuingEntrust(stockCode = '002241', amount = 200, price = 40.01, tradingAction = 'sell')
show(status)
show(contractNo)
status, cevosimractNo = es.issuingEntrust(stockCode = '002241', amount = 200, tradingAction = 'sell')
show(status)
show(contractNo)
res = es.revokeEntrust(revokeType = "allBuyAndSell", contractNo = None)
show(res)
res = es.revokeEntrust(revokeType = "allBuy", contractNo = None)
show(res)
res = es.revokeEntrust(revokeType = "allSell", contractNo = None)
show(res)
res = es.revokeEntrust(revokeType = "contractNo", contractNo = "1670247753")
show(res)

simulationHoldingShares = es.getHoldingShares()
show(simulationHoldingShares)

simulationEntrustment = es.getEntrust(dateRange = 'today', isRevocable = False)
show(simulationEntrustment)

simulationEntrustment = es.getEntrust(dateRange = 'today', isRevocable = True)
show(simulationEntrustment)
simulationClosedDeals = es.getClosedDeals(dateRange = 'today')
show(simulationClosedDeals)

simulationClosedDeals = es.getClosedDeals(dateRange = 'thisMonth')
show(simulationClosedDeals)

simulationCapitalDetails = es.getCapitalDetails(dateRange = 'today')
show(simulationCapitalDetails)

simulationCapitalDetails = es.getCapitalDetails(dateRange = 'thisMonth')
show(simulationCapitalDetails)

status = es.liquidating()
show(status)

StockCodeAmountPriceList = [['512290', '1000', '2.169'], ['512290', '1000', None]]
res = es.entrustPortfolio(StockCodeAmountPriceList)
show(res)

status = s.logoutClient()
show(status)
Clone this wiki locally