crypto-trading-ai-bot-basic icon indicating copy to clipboard operation
crypto-trading-ai-bot-basic copied to clipboard

use real time data to trade

Open diamondbarcode opened this issue 4 years ago • 2 comments

I know your code is run base on historical data for stimulation only. How do we convert it to run real-time data to evaluate how good or bad it is?

= check every 30 sec or 60 sec = do buy or sell on the virtual account

diamondbarcode avatar Feb 07 '21 20:02 diamondbarcode

I'm not sure why this would occur, but I haven't seen it. Can you provide some more details and maybe steps to reproduce? I'm not able to duplicate this at least when running the examples as they are currently set up. Can you provide reproduction steps? If you just clone givenwhenthen, run npm install, cd to /examples, and run cake test:acceptance, do you get the same issue?

If you can reproduce this when running the examples, it might be easier to dig into the issue.

wright-io avatar Jun 30 '13 00:06 wright-io

I cleaned slate and cloned givenwhenthen again, then ran npm install in the ../givenwhenthen/ directory.

I updated ../examples/test/acceptance/config.coffee to include my Saucelabs accounts.

I run cake.coffeescript test:acceptance from ../givenwhenthen/examples/ and tests are initiated within my Saucelabs account but I receive the following output and the tests do not continue:

path.existsSync is now called `fs.existsSync`.
Running 2 stories containing 2 scenarios against 1 browser/os configurations... 

/home/bot/node_modules/givenwhenthen/lib/driver.coffee:361
            locationArr = response.headers.location.split("/");
                                                    ^
TypeError: Cannot call method 'split' of undefined
    at /home/bot/node_modules/givenwhenthen/lib/driver.coffee:361:53
    at EventEmitter.<anonymous> (/home/bot/node_modules/givenwhenthen/lib/driver.coffee:339:51)
    at EventEmitter.emit (events.js:117:20)
    at EventEmitter.mixin._respond (/home/bot/node_modules/givenwhenthen/node_modules/restler/lib/restler.js:133:12)
    at EventEmitter.mixin._fireEvents (/home/bot/node_modules/givenwhenthen/node_modules/restler/lib/restler.js:138:15)
    at /home/bot/node_modules/givenwhenthen/node_modules/restler/lib/restler.js:121:19
    at IncomingMessage.parsers.auto (/home/bot/node_modules/givenwhenthen/node_modules/restler/lib/restler.js:213:5)
    at IncomingMessage.<anonymous> (/home/bot/node_modules/givenwhenthen/node_modules/restler/lib/restler.js:119:32)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:910:16

thephilwells avatar Jul 01 '13 14:07 thephilwells

Could it be trying to split the response headers before the site has had a chance to respond? Sorry for my cluelessness here. I really wish I could get this to work.

I'm running coffeescript 1.6.3 and node v0.10.3. When I try with v0.10.12 I still get this same error but I also get a memory leak warning like so:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at EventEmitter.addListener (events.js:160:15)
    at Object.request (/home/bot/node_modules/givenwhenthen/node_modules/restler/lib/restler.js:180:11)


    at Client.module.exports.Client.Client._callService (/home/bot/node_modules/givenwhenthen/lib/driver.coffee:325:24)
    at Client.module.exports.Client.Client._driver_element (/home/bot/node_modules/givenwhenthen/lib/driver.coffee:410:21)
    at Client.module.exports.Client.Client._driver_typeInElement (/home/bot/node_modules/givenwhenthen/lib/driver.coffee:478:21)
    at /home/bot/node_modules/givenwhenthen/lib/driver.coffee:77:21
    at callback (/home/bot/node_modules/givenwhenthen/lib/driver.coffee:70:39)
    at /home/bot/node_modules/givenwhenthen/lib/driver.coffee:363:53
    at EventEmitter.<anonymous> (/home/bot/node_modules/givenwhenthen/lib/driver.coffee:339:51)
    at EventEmitter.emit (events.js:117:20)

thephilwells avatar Jul 02 '13 14:07 thephilwells

Ah ha! restler.js was out of date. It was still handling eventEmitter as if node was a pre-0.10 version. I cherry-picked restler.js from the latest repo and it worked!

thephilwells avatar Jul 02 '13 16:07 thephilwells

This is great! Restler was actually my suspicion last night, but I wasn't in a place where I could try updating it. Glad you figured it out and thanks for sticking with it! I'll make a more permanent fix soon.

On Jul 2, 2013, at 9:14 AM, thephilwells [email protected] wrote:

Ah ha! restler.js was out of date. It was still handling eventEmitter as if node was a pre-0.10 version. I cherry-picked restler.js from the latest repo and it worked!

— Reply to this email directly or view it on GitHub.

wright-io avatar Jul 02 '13 18:07 wright-io

Phil: Unfortunately, I need to reopen this issue. I think you're right that it is related to Restler, but I think we're caught between two issues now. If you look back through the history, I had to lock the Restler version because they changed the error handling approach and it caused issues.

If you run the examples and check the results on SauceLabs, you'll notice that some of the tests fail. This is the issue that locking Restler to 0.2.3 fixes. This works with older versions of Node but apparently not the latest.

Now we are having different issues with later versions of Node if we don't update. So I think we need to go through the changes needed to make givenwhenthen work correctly with the new Restler error handling approach (not actually new - over one year old :-)).

wright-io avatar Jul 03 '13 22:07 wright-io

Bummer. Let me know if I can do anything to help. What I lack in development acumen I more than make up for in "simulating" clueless user behavior.

thephilwells avatar Jul 03 '13 22:07 thephilwells

Phil - I made a couple of changes to adapt to the new Restler error handling approach. Can you please check whether this works for you by grabbing the latest and running the example tests again? You should get 4 tests created in Sauce and they should all pass pretty quickly (~25 seconds). If the "WD test: Example of every method" tests fail by timing out, or there are other problems, then I'll do some deeper investigation.

wright-io avatar Jul 04 '13 17:07 wright-io

Pulled the latest and ran the samples again - all passed.

thephilwells avatar Jul 04 '13 17:07 thephilwells

Excellent!!! Now I'm working on the problem where Node 0.10.12 has the EventEmitter issue. Another problem with Restler, but seems to be related to a know fix that isn't being accepted by the author.

On Thu, Jul 4, 2013 at 10:54 AM, thephilwells [email protected]:

Pulled the latest and ran the samples again - all passed.

— Reply to this email directly or view it on GitHubhttps://github.com/wright-io/givenwhenthen/issues/15#issuecomment-20488061 .

wright-io avatar Jul 04 '13 18:07 wright-io