FX31337 / FX-BT-Scripts

:page_facing_up: Useful scripts for backtesting.
MIT License
34 stars 39 forks source link

Complete dl_bt_metaquotes.py script. #56 #113

Closed brunofarina closed 1 year ago

brunofarina commented 1 year ago

This PR is an attempt to solve issue #56.

Can someone please review it and check if the results are as expected?

Ps. I use the following command to test/download/convert to CSV, etc: python3 dl_bt_metaquotes.py -p XAUUSD -y 2022 -m 10 -c -t YYYY-MM-DD -v

kenorb commented 1 year ago

@brunofarina Thanks for the PR. Can you advice how you installed lzo package or which version? I'm having problem installing it in order to test it.

% pip3 install python-lzo
Collecting python-lzo
  Downloading python-lzo-1.14.tar.gz (14 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: python-lzo
  Building wheel for python-lzo (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      lzomodule.c:37:10: fatal error: 'lzo/lzo1x.h' file not found
      #include <lzo/lzo1x.h>
               ^~~~~~~~~~~~~
      1 error generated.
kenorb commented 1 year ago

Ok, we've managed to test it, looks good, thanks.

kenorb commented 1 year ago

Ok, we've managed to test it, briefly looks ok, let me check further. The CI tests fails for some other reason, so not to worry.

kenorb commented 1 year ago

I'm comparing the price values for EURUSD 2022.02 and I've found some weird values.

python3 dl_bt_metaquotes.py -p EURUSD -y 2022 -m 2,3 -c -t YYYY-MM-DD -a -v

For example:

2022-02-22 23:57:00,1.13264,1.13265,1.13259,1.13259,12
2022-02-22 23:58:00,1.13256,1.13259,1.1325,1.13252,17
2022-02-22 23:59:00,1.13247,1.13249,1.13241,1.13241,8
2022-02-23 00:00:00,1.13243,1.13248,1.13179,1.16097,0
2022-02-23 00:01:00,1.16033,1.16097,1.16033,1.16071,11
2022-02-23 00:02:00,1.16071,1.16071,1.16065,1.16065,2
2022-02-23 00:03:00,1.16055,1.16067,1.16051,1.16067,6
2022-02-23 00:04:00,1.16045,1.1609,1.16043,1.1609,10
...
2022-02-24 04:48:00,1.15667,1.1567,1.15607,1.15621,101
2022-02-24 04:49:00,1.15621,1.15629,1.15597,1.15599,126
2022-02-24 04:51:00,1.12773,1.12776,1.12644,1.12683,272
2022-02-24 04:52:00,1.12683,1.12733,1.12659,1.12732,208

The price value jumps suddenly from 1.13 to 1.16, then later on from 1.15 back to 1.126.

I'm comparing the data from (it maybe be slight different, but there are no sudden changes there for the same dates):

and the price value should be around 1.13 constantly through the day.

Can you double check if you're printing the right values?

The CSV columns are: time, open, high, low, close, volume. So high should always be highest from the row, low the lowest. But when you check this line (part of these higher values):

2022-02-23 00:04:00,1.16045,1.1609,1.16043,1.1609,10

The high value (1.1609) isn't high enough. Low value isn't lowest as well. Can you double check that, maybe there is still some typo?

brunofarina commented 1 year ago

Hi, Thank you for the messages. I will look at every part of the Type-2 block and make some changes. After that, I'll send it again for your review.

kenorb commented 1 year ago

Thank you for the fixes, I won't be able to verify the complete correctness in more details at this point, but the values looks better.

brunofarina commented 1 year ago

One is glad to help. So, this PR close #56 ? Can I ask to collect the bounty?