Downloading tool for information about open positions of futures on MOEX Exchange.
Downloading the following information from MOEX Exchange:
- Total count of open long and short positions by type of traders (Juridical or Physical).
- Total count of traders by type Juridical or Physical.
$ pip install requests
$ pip install psycopg2
- Open settings.ini file
- Specify futures contract name
CONTRACT
(sectionDATA_COLLECTION
) - Specify requesting date:
DAY
,MONTH
,YEAR
(sectionDATA_COLLECTION
) - Specify requesting days range:
DAYS_RANGE
(sectionDATA_COLLECTION
) - period of days from requesting date (can be negative or zero). Negative value is a past days, zero value is only requesting date, positive value is a future days. - Run main.py
or specify the same information via command line arguments:
--contract
futures contract name
--day
day of requesting date
--month
month of requesting date
--year
year of requesting date
--range
period of days from requesting date (can be negative or zero)
Recommendation is to use python 3.10 or more.
Configuration can be specified via settings.ini file.
Do not change TYPE
(it's a constant at this moment).
Specify futures contract name CONTRACT
Specify requesting date: DAY
, MONTH
, YEAR
Specify period of days from requesting date: DAYS_RANGE
. Can be negative - past. Can be zero - only requesting date.
Settings for retry attempts in case of some errors.
Specify interval in seconds between retry attempts RETRY_INTERVAL_SEC
Specify count of retry attempts RETRY_INTERVAL_COUNT
Specify interval in seconds between different days request DELAY_BETWEEN_DAY_REQUESTS_SEC
Enable or disable data storage by ENABLED
. 0 is disabled, any no zero is enabled.
Specify connection settings to PostgreSQL server: HOST
, PORT
, USER
, PASSWORD
, DB
.
You can specify the same settings via command line arguments also:
--pg_host
, --pg_port
, --pg_user
, --pg_password
, --pg_db
At first please create appropriate tables via script file. All downloaded information will be stored into these tables.
Main goal is download and keep information for internal purposes, such as manual analyze,
trading ideas or strategies, ML purposes etc.
All logs are written in logs/collector.log. Any kind of settings can be changed in main.py code
The Dockerfile is here.
Run example:
sudo docker run -i image_name:tag -e "CONTRACT=CNY" -e "DAY=13" -e "MONTH=1" -e "YEAR=2023"
Here is the chart for deployment the project on a Kubernetes cluster using the Helm package manager.
The project is configured and running as Job.
The author is not responsible for any errors or omissions, or for the trade results obtained from the use of this tool.