Skip to content

Instantiate gox client for unittest #39

Description

@v3nz3n

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions