Message Boards Message Boards

0
|
6923 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to slow down Dynamic?

Posted 10 years ago
POSTED BY: Alan Lewis
3 Replies
Posted 10 years ago

Thank you both very much. Since my original post, I discovered the exchange has a somewhat newer api and suggests a query no often than once every 2 secs. Also I just wanted a last price that I could feed to other modules. So, the code below is what I finally settled on for anybody interested.

Style[Dynamic[{DateString[], 
   ToExpression[
    StringCases[Import["https://btc-e.com/api/3/ticker/btc_usd"], 
      "last\":" ~~ x__ ~~ ",\"buy" -> x][[1]]]}, UpdateInterval -> 2, 
  TrackedSymbols :> {}], DynamicEvaluationTimeout -> 10]
POSTED BY: Alan Lewis
Posted 10 years ago

You need , TrackedSymbols :> {}, check documentation for Refresh, there is an example about that.

So the full code:

Style[Dynamic[  Import["https://btc-e.com/api/2/btc_usd/ticker"], 
                        UpdateInterval -> 5, TrackedSymbols :> {}], 
      DynamicEvaluationTimeout -> 10]
POSTED BY: Kuba Podkalicki

Hello, Here is one possible solution:

This will import every 10 seconds, and repeat 100 times. See CreateScheduledTask to modify this.

StartScheduledTask[
 CreateScheduledTask[
  bitCoinVal = {DateString[], 
    Import["https://btc-e.com/api/2/btc_usd/ticker"]}, {10, 100}]]

Dynamic[bitCoinVal]

The remote server queries are a mystery to me.

POSTED BY: W. Craig Carter
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract