Initial public release
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
# Local credentials
|
||||
/licenseFile.key
|
||||
|
||||
# Scanner-generated data
|
||||
/output/*
|
||||
!/output/.gitkeep
|
||||
/debug/
|
||||
/riskfree_rate.csv
|
||||
|
||||
# Python environments and caches
|
||||
/.venv/
|
||||
/venv/
|
||||
/env/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
.pytest_cache/
|
||||
.mypy_cache/
|
||||
.ruff_cache/
|
||||
.coverage
|
||||
htmlcov/
|
||||
|
||||
# Editors and operating systems
|
||||
/.idea/
|
||||
/.vscode/
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
Desktop.ini
|
||||
@@ -0,0 +1,85 @@
|
||||
# Multifactor Scanner 3
|
||||
|
||||
Multifactor Scanner 3 is an old multifactor equity-screening project. Originated before 2020.
|
||||
|
||||
This is the third rewrite (hence the 3), and was handcrafted before AI agents, then cleaned up with agents around 2024.
|
||||
|
||||
This README and the repository packaging are later additions.
|
||||
|
||||
## What the scanner does
|
||||
|
||||
The scanner screens equities through factor analysis. It retrieves EOD Historical Data fundamentals and compiles the results into CSV files.
|
||||
|
||||
The design covers momentum, size, value, quality, volatility, yield, growth, liquidity, and regional macroeconomic inputs.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.9
|
||||
- Everything in `requirements.txt`
|
||||
- An EOD Historical Data API token
|
||||
|
||||
The legacy `run_scanner.bat` launcher expects a Conda environment named `kwpf`. The direct Python command below does not require that environment name.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Create a project virtual environment.
|
||||
|
||||
```powershell
|
||||
py -3.9 -m venv .venv
|
||||
```
|
||||
|
||||
2. Install the dependencies.
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. Create the local risk-free-rate working file.
|
||||
|
||||
```powershell
|
||||
Copy-Item .\parameters\riskfree_rate_template.csv .\riskfree_rate.csv
|
||||
```
|
||||
|
||||
4. Save only the EOD Historical Data token in `licenseFile.key`.
|
||||
|
||||
```powershell
|
||||
Set-Content -NoNewline .\licenseFile.key 'YOUR_EODHD_API_TOKEN'
|
||||
```
|
||||
The scanner can update `riskfree_rate.csv` during a run.
|
||||
|
||||
## Configuration
|
||||
|
||||
Edit the files in `parameters/` before a run:
|
||||
|
||||
- `index_inclusion.txt` lists the index or ETF tickers that supply constituents.
|
||||
- `parent_index.txt` identifies the first benchmark ticker.
|
||||
- `ticker_inclusion.txt` adds individual tickers.
|
||||
- `ticker_exclusion.txt` removes individual tickers.
|
||||
|
||||
Place one ticker on each line. Include each exchange suffix, such as `.US` or `.TO`.
|
||||
|
||||
`regions_msci_codes.csv` maps each supported country to a regional proxy ticker. The scanner uses this mapping for regional benchmarking.
|
||||
|
||||
## Run the scanner
|
||||
|
||||
Run the scanner from the repository root:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\python.exe .\run_scanner.py
|
||||
```
|
||||
|
||||
## Generated files
|
||||
|
||||
The scanner writes the following:
|
||||
|
||||
- `output/YYYYMMDD.csv` contains the standardized final scores.
|
||||
- `output/YYYYMMDDdump.csv` contains the unstandardized intermediate table.
|
||||
- `output/rejected_tickers.txt` lists rejected tickers.
|
||||
- `debug/*.json` contains selected API responses for failed calculations.
|
||||
- `riskfree_rate.csv` stores the current rate data and provides fallback data.
|
||||
|
||||
## Important limitations
|
||||
|
||||
This repository preserves old code. The current vendor and source websites have changed since.
|
||||
|
||||
The sample contains historical market data. It is not a current ranking, recommendation, or investment result.
|
||||
@@ -0,0 +1,4 @@
|
||||
Ticker,Name,Price,Dividend Yield,Country Name,Sector,Industry,Earnings Report,Momentum fct,Size fct,Liquidity 1M fct,Liquidity 3M fct,Liquidity 12M fct,Return-on-Assets fct,Return-on-Equity fct,Equity-to-Debt fct,Earnings Vol fct,Asset Growth fct,Earnings Quality fct,Earnings Yield fct,Book Value fct,3M Vol fct,12M Vol fct,Max Vol,Payout Ratio,Dividend Growth 5Y,% Above Index,EPS Growth fct,LT Reversal fct,LT_has_history,Regional Momentum,Regional Riskfree Rate,Regional Riskfree Rate Change,Regional Volatility 3M,Regional Volatility 12M,Return-on-Assets Z-Scores,Return-on-Equity Z-Scores,Equity-to-Debt Z-Scores,Earnings Vol Z-Scores,Asset Growth Z-Scores,Earnings Quality Z-Scores,Earnings Yield Z-Scores,Book Value Z-Scores,EPS Growth Z-Scores,Liquidity 1M Z-Scores,Liquidity 3M Z-Scores,Liquidity 12M Z-Scores,LT Reversal Z-Scores,Max Z-Scores,Liquidity Z-Scores,Profitability Z-Scores,Momentum Z-Scores,Size Z-Scores,Quality,Quality DFM,Quality FaCS,Value DFM,Value Enhanced,Value FaCS,QVMS,GARP,FaCS
|
||||
ALA.TO,AltaGas Ltd,26.53,0.04165096117602714,Canada,Energy,Oil & Gas Midstream,,-0.10544265354057888,0.04453531641989873,-3.1229996681388066,-2.003312631767157,-0.23008235708571068,0.03224596925384327,0.089711826835311,0.5611326553010902,0.2550387899072393,0.01706036745406824,0.05046948356807512,0.07764794572182435,0.9476818695816057,0.19616737885109206,0.22149380979081368,0.22149380979081368,0.5364077669902912,0.1385339366515837,0.020980961176027137,0.1423728813559322,-2.4120493784083226,1,-0.32885904191397825,0.05,0.0025,0.18757521344502243,0.1950203798542375,-0.4984328408451455,-0.35102456963338935,-0.4577516951792726,-0.3296536450072228,0.058066703354132325,0.06067946626007255,-0.34894068573278586,0.7475649037643032,-0.17800247076201825,-0.6284171262211351,-0.624559520276873,-0.324069816460327,-0.020227265451684073,-0.777827208355825,-0.5256821543194451,-0.4247287052392674,-0.1771459500303661,-0.5112095844336865,-0.3794766366066282,-0.21867757516231162,-0.17492130142957757,0.016561177432910485,0.07354058242316636,0.012882333144451008,-0.22261798304836342,-0.24857289716187858,-0.20567939470223945
|
||||
CVX.US,Chevron Corp,165.19,0.0360191294872571,USA,Energy,Oil & Gas Integrated,2023-10-26,-0.07281694021782119,0.03776037931557237,-2.5377462052936535,-1.4186923546580323,0.05512250736953844,0.11981936539584317,0.19054476551397442,0.6288252793124128,2.0104938131207537,0.021521254751190527,0.1409133584630691,0.09552636358133058,0.5132937829166414,0.16344842770508258,0.24976400733100598,0.24976400733100598,0.3770595690747782,0.2833613445378151,0.015349129487257099,0.46375921375921364,-1.6711457833170138,1,0.26543014672143805,0.055,0.0025,0.1198116946671534,0.17005814977602426,0.07113104463196823,-0.1420463174552547,-0.42063286689165147,-0.24189041342275228,0.05900820498950566,0.0655472439254419,-0.259979234244734,-0.27031459076730957,-0.1023553313608065,-0.05378011228904508,-0.0508330507275735,-0.024564884651429524,-4.7501203184222605e-05,-0.6496184453420658,-0.0430593492226827,-0.035457636411643234,-0.1331785099944964,-2.654895359700109,-0.2681898659232195,-0.1146850935622199,-0.06054095691347439,-0.26342435308559253,-0.21088305212428338,-0.23708666789735172,-0.7915458290856044,-0.8167866969355271,-0.6376113651732476
|
||||
OVV.US,Ovintiv Inc,45.19,0.024341668510732467,USA,Energy,Oil & Gas E&P,2023-11-06,-0.0488782317824996,0.04290898001804433,-1.3076385671623734,-0.33240762949684477,1.2045527190319614,0.17132025206209334,0.3589523400601116,0.9130647848671959,0.9877465787312462,0.11111224960295098,0.28269507143460987,0.2898871431732684,0.7526443903518478,0.35548618339876337,0.5074110034309227,0.5074110034309227,0.08396946564885498,0.5427545454545455,0.003671668510732466,0.18546168958742631,0.28615870977801655,1,0.26543014672143805,0.055,0.0025,0.1198116946671534,0.17005814977602426,0.40608488229726225,0.20698169901827215,-0.26477190636098014,-0.2930222289333486,0.07791701450416658,0.07317807416753355,0.7071430917196084,0.29054350546287055,-0.16786033105574794,1.1540134760725804,1.0152098572841985,1.1824973364666738,0.0532630016677318,0.5188418251324525,1.1172402232744842,0.3065332906577672,-0.10091795166573818,-1.0258053890540617,-0.11693747875868554,-0.020033151192972286,0.044682827920575735,0.5682765629673625,0.276608755375577,0.5167752068373993,-0.14461998223635242,-0.24176301602572708,-0.14662512740351455
|
||||
|
@@ -0,0 +1,3 @@
|
||||
IWV.US
|
||||
IDEV.US
|
||||
SCZ.US
|
||||
@@ -0,0 +1 @@
|
||||
URTH.US
|
||||
@@ -0,0 +1,14 @@
|
||||
Country,Currency,Rate,Rate Change
|
||||
United States,USD,0.055,0.0025
|
||||
Australia,AUD,0.041,0.0025
|
||||
Germany,EUR,0.045,0.0025
|
||||
Switzerland,CHF,0.0175,0.0025
|
||||
Sweden,SEK,0.04,0.0025
|
||||
Japan,JPY,-0.001,-0.001
|
||||
United Kingdom,GBP,0.0525,0.0025
|
||||
Norway,NOK,0.0425,0.0025
|
||||
Denmark,DKK,0.0335,0.0025
|
||||
Canada,CAD,0.05,0.0025
|
||||
Hong Kong,HKD,0.0575,0.0025
|
||||
Singapore,SGD,0.0357,-0.0014
|
||||
Israel,ILS,0.0475,0.0025
|
||||
|
@@ -0,0 +1,14 @@
|
||||
.
|
||||
ACS-D.MC
|
||||
ACS/D.MC
|
||||
S68.SG
|
||||
FAE-D.MC
|
||||
FAE/D.MC
|
||||
CAST-TR.ST
|
||||
CAST-BTA.ST
|
||||
-.LS
|
||||
-.US
|
||||
BHM-WI.US
|
||||
NKT-T.CO
|
||||
NOVO-B.US
|
||||
ANAB.US
|
||||
@@ -0,0 +1,22 @@
|
||||
Country,Ticker
|
||||
Australia,EWA.US
|
||||
Belgium,EZU.US
|
||||
Canada,EWC.US
|
||||
Denmark,EZU.US
|
||||
Finland,EZU.US
|
||||
France,EZU.US
|
||||
Germany,EZU.US
|
||||
Hong Kong,EWH.US
|
||||
Ireland,EZU.US
|
||||
Israel,EIS.US
|
||||
Italy,EZU.US
|
||||
Japan,EWJ.US
|
||||
Netherlands,EZU.US
|
||||
Norway,EZU.US
|
||||
Portugal,EZU.US
|
||||
Singapore,EWS.US
|
||||
Spain,EZU.US
|
||||
Sweden,EZU.US
|
||||
Switzerland,EZU.US
|
||||
UK,EWU.US
|
||||
USA,PBUS.US
|
||||
|
@@ -0,0 +1,6 @@
|
||||
pandas
|
||||
numpy
|
||||
requests
|
||||
lxml
|
||||
python-dateutil
|
||||
ta
|
||||
@@ -0,0 +1,3 @@
|
||||
call conda activate kwpf
|
||||
python run_scanner.py
|
||||
call conda deactivate
|
||||
+1058
File diff suppressed because it is too large
Load Diff
+1057
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user