Off-market

No Liability Disclaimer

LiuAlgoTrader is provided with sample scanners and out-of-the-box strategies. You may choose to use it, modify it or completely disregard it - Regardless, LiuAlgoTrader and its Authors bare no responsibility to any possible loses from using LiuAlgoTrader, or any of its derivatives (on the other hand, they also won’t share your profits, if there are any).

market_miner

While the trader application is used for real-time calculations, the market_miner application is intended for off-market batch calculations and data collections.

The market_miner application is configured by the miner.toml configuration file. Quite similar to how the trader application is configured by tradeplan.toml configuration file.

An example of miner.toml file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# This is a TOML configuration file for market_miner.py
[miners]

#
# grab industry-sector and other details for symbol
#
[miners.StockCluster]

#
# Store daily OHLC data
#
[miners.DailyOHLC]
filename = "<select-path>/examples/miners/daily_ohlc.py"
#symbols = ['SPY',]
days = 14

max_share_price = 20.0
min_share_price = 2.0

#
# Calculate P&L
#
[miners.gainloss]
days = 45

#
# Calculate Momentum Portfolio
#
[miners.portfolio]
atr_days = 20
debug = true
filename = "<select-path>/portfolio.py"
index = 'SP500'
indicators = ['SMA100']
portfolio_size = 2000
rank_days = 90
risk_factor = 0.002

miners

Currently supported miners:

  • StockCluster : the miner read all trade-able stocks, and stores in the ticker_data table the industry/segment and similar stocks details. This data can later be used in real-time to compare how a certain stock is doing against an industry/segment or similar stocks index.
  • gainloss: populate gainloss table with per-batch aggregated P&L details.

Notes

  1. The market_miner app should be executed in off-market hours, and once run it will refresh existing data, or load data since last run,
  2. Additional miners can be found in the examples folder (and should be downloaded separately),

Prerequisites

  1. Installed & configured PostgreSQL instance, hosting a database with LiuAlgoTrader schema,
  2. Ensuring environment variables are properly set including Alpaca Market API credentials, and the database DSN,

Usage

To run the market_miner app type:

market_miner

The expected result should look like:

*market_miner* output