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

Instantiate gox client for unittest #39

Open
v3nz3n opened this issue Jul 12, 2013 · 0 comments
Open

Instantiate gox client for unittest #39

v3nz3n opened this issue Jul 12, 2013 · 0 comments

Comments

@v3nz3n
Copy link

v3nz3n commented Jul 12, 2013

My strategies have become so bulky and interdependent that testing new code by simply starting goxtool is proving impractical. I would like to instantiate a BaseClient so that I may import goxapi and my strategy into a unittest and then access my strategy and goxapi class functions:

So far I have:

import unittest
import goxapi
import mystrategy

#construct a minimal API client
config = goxapi.GoxConfig("goxtool.ini")
secret = goxapi.Secret(config)
client = goxapi.BaseClient('BTC','USD',secret,config)

Then I create the client instance:

mygox = goxapi.Gox(secret, config)
mystrat = mystrategy.Strategy(mygox)

This way of instantiating throws an exception as soon as the Strategy init() is executed since the various slots and signals have not been called or created yet.

Am I doing this right and optimally? Is there a 'lighter' instantiation process I could use? My objective is simply to access the Strategy functions and it is not necessary to have all of the 'moving parts' such as http socket and signals functioning. Is there a way of doing this?

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

1 participant