Skip to content
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

Failed to get candlesticks. #10

Open
wikbon opened this issue May 7, 2023 · 3 comments
Open

Failed to get candlesticks. #10

wikbon opened this issue May 7, 2023 · 3 comments

Comments

@wikbon
Copy link

wikbon commented May 7, 2023

Good day to you! I've been wondering about trying out this plugin. I've created all of the requried accounts and entered all of the ids and api keys, but when i try to run it, it always Failed to get candlesticks. I let it run for a few commands and it also throws Error: DataFrame constructor not properly called!. I'm kinda new to github issues, so appologies for poor formatting. Thank you in advance for any help.
image

@remixxan
Copy link

remixxan commented May 11, 2023

I have the same issue. It's trying to use google instead. Got it all set up and double checked regarding the installation. Any ideas on what is causing the problem?

` THOUGHTS: I will use the 'fetch_candlesticks' command to fetch GBPUSD 1D data for the last 30 days from MarketWatch.
REASONING: I found a link on MarketWatch that allows me to download the data directly. The 'fetch_candlesticks' command
is the most appropriate for this task as it allows me to fetch candlestick data for a given symbol and timeframe.
PLAN:

  • Use the 'fetch_candlesticks' command to fetch GBPUSD 1D data for the last 30 days from MarketWatch.
  • Save the data to a file.
    CRITICISM: I need to ensure that the data I fetch is accurate and up-to-date. I also need to ensure that I save the data to a file in a format that is easy to read and analyze.
    NEXT ACTION: COMMAND = fetch_candlesticks ARGUMENTS = {'symbol': 'GBPUSD', 'timeframe': '1D'}
    SYSTEM: Command fetch_candlesticks returned: Failed to get candlesticks.
    THOUGHTS: I will use the 'google' command to search for a Python script that can fetch GBPUSD 1D data from MarketWatch.
    REASONING: The 'fetch_candlesticks' command failed to fetch the data. I need to find an alternative way to fetch the data. The 'google' command is the most appropriate for this task as it allows me to search for Python scripts that can fetch financial data from MarketWatch.`

@toobongo999
Copy link

I have a similar issue, but took me a while to work out that some currency pairs work. For example:

Metatrader symbols that work: EURGBP, USDJPN, USDSGD,
Not working: USDEUR, EURUSD, AUSUSD (Because USDEUR wasn't working, I got it to put the pair as EURUSD to see if that worked, but it didn't.)

I am able able to successfully pull the following:
get_account_information
get_positions
get_stock_of_the_day
get_important_forex_news

I am also able to successfully do all of the following for currencies that work:
rsi
money_flow_index
volume
ema
macd
fib_retracements
stochastic_oscillator

I can't pull:
get_sentiment
With SMA, I get 'min_periods must be an integer' but when it then tries to add min periods with an integer it gets an error. Someone else has raised this.

In order to troubleshoot further, it is worth establishing what does work, for example, put the objective as:

To conduct troubleshooting on the MT4 Metatrader API. The aim is just to find what works with the API. It is not to find profitable trading opportunities. Create a file called GPTCurrencyText.txt. Run through the different currency pairs to see which ones work and which ones do not, using the following command: COMMAND = fetch_candlesticks ARGUMENTS = {'symbol': '', 'timeframe': '1h'} but cylcing through each currency pair, including EURGBP, USDJPN, USDSGD, USDEUR, EURUSD, AUSUSD. After each test, store the result in GPTCurrencyText.txt file and move on to the next currency pair.

(I wasn't successful in getting it to generate a file, but it did seem to keep it pretty focused on going through the different pairs.)

Also:
To conduct troubleshooting on the MT4 Metatrader API. The aim is just to find what works with the API. It is not to find profitable trading opportunities. Run through the different commands to see which ones work and which ones do not, including the following requests: get_account_information, get_positions, get_stock_of_the_day, get_important_forex_news, get_sentiment

My guess is that there are idiosyncrasies between brokers requiring slightly different syntax, and this is leading to the issues, but further diagnosis needed.

@Silas38100
Copy link

Silas38100 commented May 26, 2023

regarding the SMA issue, I modifyed the code in "Indicators.py" as follow and it works !

 def sma(candlesticks, period):
     # Get the candlesticks data
     if candlesticks:
         df = pd.DataFrame(candlesticks, columns=['close'])
         df = df.dropna()
         sma = SMAIndicator(df['close'], window=int(period))  # Convert period to integer
         return f'Current Simple Moving Average Value: {sma.sma_indicator().iloc[-1]}'
 
     if not candlesticks:
         return 'Failed to get candlesticks'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants