[Mod] update chinese display for new algos

This commit is contained in:
vn.py 2019-06-14 12:12:41 +08:00
parent 0e540386c7
commit e55138b80e
3 changed files with 33 additions and 18 deletions

View File

@ -7,8 +7,8 @@ from vnpy.trader.ui import MainWindow, create_qapp
# from vnpy.gateway.bitmex import BitmexGateway
# from vnpy.gateway.futu import FutuGateway
# from vnpy.gateway.ib import IbGateway
# from vnpy.gateway.ctp import CtpGateway
from vnpy.gateway.ctptest import CtptestGateway
from vnpy.gateway.ctp import CtpGateway
# from vnpy.gateway.ctptest import CtptestGateway
# from vnpy.gateway.femas import FemasGateway
# from vnpy.gateway.tiger import TigerGateway
# from vnpy.gateway.oes import OesGateway
@ -22,7 +22,7 @@ from vnpy.gateway.ctptest import CtptestGateway
# from vnpy.app.cta_strategy import CtaStrategyApp
# from vnpy.app.csv_loader import CsvLoaderApp
# from vnpy.app.algo_trading import AlgoTradingApp
from vnpy.app.algo_trading import AlgoTradingApp
# from vnpy.app.cta_backtester import CtaBacktesterApp
# from vnpy.app.data_recorder import DataRecorderApp
# from vnpy.app.risk_manager import RiskManagerApp
@ -38,8 +38,8 @@ def main():
# main_engine.add_gateway(BinanceGateway)
# main_engine.add_gateway(XtpGateway)
# main_engine.add_gateway(CtpGateway)
main_engine.add_gateway(CtptestGateway)
main_engine.add_gateway(CtpGateway)
# main_engine.add_gateway(CtptestGateway)
# main_engine.add_gateway(FemasGateway)
# main_engine.add_gateway(IbGateway)
# main_engine.add_gateway(FutuGateway)
@ -56,7 +56,7 @@ def main():
# main_engine.add_app(CtaStrategyApp)
# main_engine.add_app(CtaBacktesterApp)
# main_engine.add_app(CsvLoaderApp)
# main_engine.add_app(AlgoTradingApp)
main_engine.add_app(AlgoTradingApp)
# main_engine.add_app(DataRecorderApp)
# main_engine.add_app(RiskManagerApp)

View File

@ -75,8 +75,10 @@ class GridAlgo(AlgoTemplate):
self.cancel_all()
# Calculate target volume to buy
target_buy_distance = (self.price - self.last_tick.ask_price_1) / self.step_price
target_buy_position = math.floor(target_buy_distance) * self.step_volume
target_buy_distance = (
self.price - self.last_tick.ask_price_1) / self.step_price
target_buy_position = math.floor(
target_buy_distance) * self.step_volume
target_buy_volume = target_buy_position - self.last_pos
# Buy when price dropping
@ -88,8 +90,10 @@ class GridAlgo(AlgoTemplate):
)
# Calculate target volume to sell
target_sell_distance = (self.price - self.last_tick.bid_price_1) / self.step_price
target_sell_position = math.ceil(target_sell_distance) * self.step_volume
target_sell_distance = (
self.price - self.last_tick.bid_price_1) / self.step_price
target_sell_position = math.ceil(
target_sell_distance) * self.step_volume
target_sell_volume = self.last_pos - target_sell_position
# Sell when price rising

View File

@ -12,5 +12,16 @@ NAME_DISPLAY_MAP = {
"timer_count": "本轮读秒",
"total_count": "累计读秒",
"template_name": "算法模板",
"display_volume": "挂出数量"
"display_volume": "挂出数量",
"stop_price": "触发价格",
"price_add": "委托超价",
"trade_count": "交易次数限制",
"step_price": "网格交易间距",
"step_volume": "网格交易数量",
"order_type": "类型",
"active_vt_symbol": "主动腿",
"passive_vt_symbol": "被动腿",
"spread_up": "价差上限",
"spread_down": "价差下限",
"max_pos": "最大持仓"
}