Skip to content
TORNLIFE More

Quick questions

Started by Flak [2091491] on in API Development.

12 replies · 168 views · thread synced · 6 days ago · View on torn.com
About this thread

Posts archived: 13 / 13 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
13
Discussion span
→
People posting
5
Likes on archived posts
11
Posts by staff, officers and moderators
1
Authority score
72 / 100
Historical score
19 / 100
Story score
31 / 100
Engagement score
54 / 100

Most-liked replies

Flak [2091491]
Am i right in thinking its 0.6 seconds per api call to not get in trouble?

And say they had blocked my API from working... how long that last? >_<

(Recently got faster internet and now having to add in delays everywhere lol...)
Omanpx [1906686]
If you are addressing the current API issues - the API is disabled due to server issues. Doubt you can get banned for ignoring the call limits, you would just get the limit errors.
Flak [2091491]
Ahhh gotcha! ty! Not just mine thats disabled this time! (i got 'rate limited' and ip blocked yesterday too)... Hope my bad code wasn't contributing to the troubles!
evil_inside1332 [1899761]
You can use commas to make multiple selections in each category per call, if you are trading stocks you can make a personal ticker to log prices that way you will only make one call per minute to get the prices and you don't have to make 35 individual calls in each stock.

For items you can make a sheet to list the item IDs that you currently trade, and have the script make calls based off of the IDs you have in the sheet.

Also if for some other reason you manage to exceed the 100 calls limit, you will have to stagger your calls so as to not exceed the 100 per minute limit
evil_inside1332 [1899761]
I can sorta recall that ched said somewhere that your IP can be banned for making excessive calls of a ridiculous nature, but my guess is that will be something rare after a review of activity.
DeKleineKobini [2114440] Committee Committee
As far as I know, there has always been an actual IP limit. A couple of months ago it was changed to 1k per minute, before that it was "somewhere between 1k and 2k".
Blainyckz_ [606698]
I think you'd have to be REAAAAAAAAAAAALLY hammering the API for you to get any form of formal warning/ban. I've had various things running for long periods of time and never had issues. My first itteration of my JobFinder was running on my API keys for months and that was horrifically inefficent haha.

Normally if I know i'ma be running code for a while I'll just put like a .5 sec break in per iteration or something. Not ideal but atleast then I know it's probably not going to trip up with other calls from Torn related tools and I won't end up on a shit list for sending in too many calls at a time hahaha.
Omanpx [1906686]
Does the torn/stocks call work with stock IDs though? I believe it only returns the first stock ID if you enter more than one.
evil_inside1332 [1899761]
the syntax for calling with stock id is: "https://api.torn.com/torn/"+id+"?selections=stocks&key="+key
var id can be anything from 1 through 35 this will return more information on the selected id (one per call - 35 calls total) than if you use: "https://api.torn.com/torn/?selections=stocks&key="+key which will return all stock prices.

however, you can dump the call "https://api.torn.com/torn/?selections=stocks&key="+key into a spreadsheet, and reconstruct the first method from the spreadsheet. by doing it this way, you will only make one call per minute instead of 35 calls per minute
Omanpx [1906686]
Ah, i thought you mean you can join multiple IDs in one call to get all the yearly / monthly / weekly / etc. prices for individual stocks.

The issue with the general torn/stocks call is that it only includes current value, so if you need the more detailed data (which is the case in a lot of scenarios), you either have to make the 35 individual calls, or keep a database logging values from the general stocks call and build the periodic values yourself.