mhallsmoore / qsforex

QuantStart Forex Backtesting and Live Trading
http://www.quantstart.com
775 stars 353 forks source link

No result from the screen #7

Open zwblst007 opened 9 years ago

zwblst007 commented 9 years ago

Hi Mike,

I previously implemented your code that you provided in Trading Diary #1 and #2, and it seems good. However, after I updated the code according to the Github resource, when I run the trading.py there's no feedback from the screen, and no error information neither. Any suggestions?

Best,

Weibo

mhallsmoore commented 9 years ago

Hi Weibo,

Are you running this in Windows, Mac or Linux?

If the latter, have you got the environment variables set for your account properly in your shell file?

Mike.

zwblst007 commented 9 years ago

Hi Mike,

I'm running it in Windows.

At present, to make the program easy to understand, I directly assign the value to those variables in settings.py, like: ACCOUNT_ID = '1234567'

Best,

Weibo

mhallsmoore commented 9 years ago

Hi Weibo,

If you download the latest version of the code (updated a couple of days ago) and try running trading.py with the OANDA practice account open, do you see any trades being made?

You should be seeing some tick data output through the console.

If you're not seeing anything I think that might mean that the streaming prices object is not functioning correctly.

I presume you've installed all of the necessary dependencies (including the 'requests' library?). I imagine you have, otherwise you'd get some error messages, but good to check!

What version of Python are you running? Is it 2.7.x or 3.4.x?

Mike.

zwblst007 commented 9 years ago

Hi Mike,

I rewrite the code and now the program can show some tick data on the screen. In line 150 and 171 of portfolio.py, my Python notifies that:

undefined name 'add_position_units'

However, if I change it to 'self.add_position_units', there's no notifications anymore, but the program just don't give me any feedback on the screen. How does that happen?

Besides, in line 46 of trading.py, you write 'heartbeat = 0.0', and the reference is 'half a sencond between polling'. I'm a little confused, shouldn't the heartbeat be 0.5?

By the way, I'm using Python 3.4.

Best,

Weibo

mhallsmoore commented 9 years ago

Hi Weibo,

Would you mind sending me any of the modifications you have made, in particular any changes to strategy.py? I can then try and replicate your error. The current code-base seems to work fine on my system (including Python 3.4), so I'd like to know if you've done anything differently. My email address is mike AT quantstart DOT com.

I've also modified the requirements.txt file, so if you update your packages that accordingly, we can make sure that isn't the problem.

And, as to your reference to the heartbeat being 0.0 instead of 0.5, yes, this is a slip-up on my part! The comment needs to be changed. I've added this as an issue: https://github.com/mhallsmoore/qsforex/issues/15

Kind regards, Mike.

zwblst007 commented 9 years ago

Hi Mike,

I update all the packages, and now the program seems to work fine.

The only modification I made is in portfolio.py, and I already sent a mail to you.

I have another question, in the price.py, you write the following codes:

inv_bid = (Decimal("1.0")/bid).quantize(Decimal("0.00001")) inv_ask = (Decimal("1.0")/ask).quantize(Decimal("0.00001"))

However, if we want to get the quote of USDGBP from quote of GBPUSD, maybe we should use the following equation:

inv_bid = 1/ask inv_ask = 1/bid

Am I making any misunderstanding?

By the way, I just bought your book "Successful Algorithmic Trading" and it's amazing! I have a question: what is the main difference between those two packages of this book? Will the $79 package provide some codes that $39 package doesn't include?

Best,

Weibo

Simangaliso commented 7 years ago

Hi Weibo I have the same problem, may you please share how you fixed it