xdusongwei / HODL

通过对多头仓位做T的方式来提升赌场存活率的自动化交易系统🎰
MIT License
3 stars 1 forks source link

config.toml 怎么配置 #1

Open monday99 opened 1 month ago

monday99 commented 1 month ago

config.toml 怎么配置

xdusongwei commented 1 month ago
# 根配置在 VariableTools 中定义
db_path = ".../data.db"
async_market_status = true
html_file_path = ".../state.html"
log_root = ".../logs/hodl"

# 每个持仓的部分在 StoreConfig 中定义
[store.AAPL_futu]
region = "US"
currency = "USD"
broker = "futu"
symbol = "AAPL"
trade_strategy = "hodl"
trade_type = "stock"
name = "apple"
enable = true
visible = true
max_shares = 12345
precision = 2
shares_per_unit = 1
booting_check = true
lock_position = true
state_file_path = ".../state-{broker}-{symbol}-stage{stage}.json"
state_archive_folder = ".../hodl/archive-{broker}-{symbol}"
buy_spread_rate = 0.0
sell_spread_rate = 0.004
buy_order_rate = 0.002
sell_order_rate = 0.002
base_price_last_buy = true
base_price_day_low = true
base_price_tumble_protect = true
tumble_protect_rsi = true
price_rate = 1.0
market_price_rate = 0.005
base_price_isolated = true
sleep_mode = true

# 每家券商的参数在 BrokerApiBase.on_init 方法中定义
[broker.tiger]
pk_path = ".../sk.pem"
tiger_id = ""
account = ""
timeout = 8

[broker.futu]
host = ""
port = 1234
# 实盘填 REAL, 模拟盘填 SIMULATE, 不填有效值则为实盘通道
trade_env = "REAL"
# 实盘操作订单需要解锁密码
# https://openapi.futunn.com/futu-api-doc/trade/unlock.html
# 这里储存密码的md5值, 使用命令 
# macos: md5 -s "123456" 
# linux: echo -n "123456" | md5sum
# 无有效值不会触发解锁动作
unlock_pin = ""
# 如果交易网关和该服务不在一个机器上, 得按富途的方式生成通信私钥文件
pk_path = ".../sk.pem"

[broker.longport]
app_key = ''
app_secret = ''
# 需要指定一个文件位置, 以便存储刷新token
token_path = '.../longport_accesstoken.toml'
auto_refresh_token = true

[broker.interactiveBrokers]
connection_type = "TWS"
host = ""
port = 1234
timeout = 5
client_id = 1234
account_id = "U..."

# 券商功能自定义
# 不炒港股, 所以实际上仅支持美股交易
[[broker_meta.tiger]]
trade_type = 'stock'
share_market_status= true
share_quote = true
market_status_regions = ['US', 'HK', 'CN', ]
quote_regions = ['US', ]
trade_regions = ['US', 'HK', ]
vix_symbol = 'VIX'

[[broker_meta.futu]]
trade_type = 'stock'
share_market_status= true
share_quote = true
market_status_regions = ['US', 'HK', 'CN', ]
quote_regions = ['HK', 'CN', ]
trade_regions = ['US', ]

[[broker_meta.longport]]
trade_type = 'stock'
share_market_status= false
share_quote = true
market_status_regions = []
quote_regions = ['CN', 'HK', ]
trade_regions = ['US', ]

[[broker_meta.interactiveBrokers]]
trade_type = 'stock'
share_market_status= false
share_quote = false
market_status_regions = []
quote_regions = []
trade_regions = ['US', ]
monday99 commented 1 month ago

你好,能留个联系方式吗,对量化开发比较感兴趣

xdusongwei commented 1 month ago

image

xinmans commented 1 week ago

longport_accesstoken.toml 格式是如何的?

xdusongwei commented 1 week ago

longport_accesstoken.toml 格式是如何的?

longport.py#L21

xinmans commented 1 week ago

longport_accesstoken.toml 格式是如何的?

longport.py#L21

已经调试出来了,格式如下

token = "m_xxxxxE" expiry = "2025-02-12T12:13:57.859Z"