-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add get forex data #258
Open
Boreas813
wants to merge
9
commits into
enzoampil:master
Choose a base branch
from
Boreas813:add_get_forex_data
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add get forex data #258
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fd8bbb2
add most method
Boreas813 491e86b
get forex data method done
Boreas813 ee54c17
Merge branch 'master' of https://github.com/enzoampil/fastquant into …
Boreas813 e496a81
fix bugs, use mulitprocess, write readme
Boreas813 2d11fd0
Merge branch 'master' of https://github.com/enzoampil/fastquant into …
Boreas813 4073e30
repair work
Boreas813 3cf0a9a
Rename tset_forex.py to test_forex.py
jpdeleon 61731c5
split function, cancel multi - process
Boreas813 b45783f
Merge branch 'add_get_forex_data' of https://github.com/Boreas514/fas…
Boreas813 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import numpy as np | ||
|
||
# Import from config | ||
from fastquant.config import DATA_FORMAT_COLS | ||
|
||
# Import package | ||
from fastquant.data.forex.forextester import get_forextester_data, get_local_data | ||
|
||
|
||
def get_forex_data(symbol, start_date=None, end_date=None, source="forextester", period='D1', read_from_local=False): | ||
"""Returns pricing data for a specified forex pair. | ||
|
||
Parameters | ||
---------- | ||
symbol : str | ||
Symbol of the forex in the forextester. | ||
https://forextester.com/data/datasources | ||
start_date : str | ||
Starting date (YYYY-MM-DD) of the period that you want to get data on | ||
in most cases we need more wide time period to test strategy, so keep this to None | ||
end_date : str | ||
Ending date (YYYY-MM-DD) of the period you want to get data on | ||
in most cases we need more wide time period to test strategy, so keep this to None | ||
source : str | ||
Source of forex history data | ||
period : str | ||
time period you want, support 1 minute,15 minutes,1 hour,1 day,1 week | ||
this parameter must one of them:["M1", "M15", "H1", "D1", "W1"] | ||
read_from_local : bool | ||
if this parameter set False, method get data from online | ||
if set it to True, method get data from local pickle file, faster than set it to False | ||
|
||
Returns | ||
------- | ||
pandas.DataFrame | ||
""" | ||
|
||
if source == "forextester": | ||
if read_from_local is False: | ||
df = get_forextester_data(symbol, start_date, end_date, period) | ||
else: | ||
df = get_local_data(symbol, start_date, end_date, period) | ||
else: | ||
raise Exception("Source must be forextester") | ||
|
||
return df |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read_from_local=True