CSGO-Market
Simplified CSGO skin pricing API
Straight from Steam's community market
Use case:
var csgomarket = ; csgomarket; // If you want to disable strictNameMode.csgomarketstrictNameMode = false; // Notice the missing '-' in AK 47. With strictNameMode off it will internally swap to 'AK-47'.csgomarket;
Example output from above code (prices will always return in USD):
- Lowest price: $80.50
- Median price: $80.01
- 48 sold/bought on the market
Methods
callback
with 2 arguments (err, data)
where data
is the response if successful, otherwise, err
will be populated with a message.
Each function returns data from the Steam market to getSinglePrice(wep, skin, wear, stattrak, callback)
- wep: Name of the weapon to be requested. Ex:
'AK-47'
. - skin: Name of the skin to be requested. Ex:
'Vulcan'
. - wear: Wear of the skin to be requested. These options are available:
Factory New
,Minimal Wear
,Field-Tested
,Well-Worn
, andBattle-Scarred
. Defaults to'Field-Tested'
but a Levenshtein distance will be used to ensure a match. - stattrak: Boolean which signifies if you want StatTrak to be included in the request or not. Defaults to
false
- callback: Callback function which returns the request data.
function(err, data)
.
getSingleKnifePrice(knife, skin, wear, stattrak, callback)
- knife: Name of the knife to be requested. Ex:
'Karambit'
. - skin: Name of the skin to be requested. Ex:
'Crimson Web'
.Note:
If skin is set tonull
then it will request the version of the Knife with no skin. example of a knife with no skin - wear: Wear of the skin to be requested. These options are available:
Factory New
,Minimal Wear
,Field-Tested
,Well-Worn
, andBattle-Scarred
. Defaults to'Field-Tested'
but a Levenshtein distance will be used to ensure a match.Note:
If skin is set tonull
wear will also be set tonull
. - stattrak: Boolean which signifies if you want StatTrak to be included in the request or not. Defaults to
false
- callback: Callback function which returns the request data.
function(err, data)
.
getSingleStickerPrice(stickerName, foil, callback)
- stickerName: Name of the Sticker to be requested
Note: Do not include the initial
'Sticker | '
infront of the sticker name. Also, do not include'(Foil)'
within the name. Ex:'Robo'
or'kennyS | Cologne 2015'
. - foil: Boolean which signifies if you want the (Foil) option included in the request. Note: Not all stickers have foil counterparts.
- callback: Callback function which returns the request data.
function(err, data)
.
getSingleKeyPrice(key, callback)
-
key: Name of the key to be requested. Supports any Case Key and the eSports key. Does not support capsule keys currently. Example strings you can pass in:
'Chroma'
,'Winter Offensive'
or'eSports'
.'Key'
or'Case Key'
do not need to be added to the name. -
callback: Callback function which returns the request data.
function(err, data)
.
Asyncrhonous Methods
getSinglePriceAsync(wep, skin, wear, statrak)
Same parameters minus the callback as the non-async version. Promisified version of the getSinglePrice method (Example usage below).
getSingleKnifePriceAsync(knife, skin, wear, stattrak)
Same parameters minus the callback as the non-async version. Promisified version of the getSingleKnifePrice method.
getSingleStickerPriceAsync(stickerName, foil)
Same parameters minus the callback as the non-async version. Promisified version of the getSingleStickerPrice method.
getSingleKeyPriceAsync(key)
Same parameters minus the callback as the non-async version. Promisified version of the getSingleKeyPrice method.
Use case:
var csgomarket = ;var Q = ; var wears = 'Factory New' 'Minimal Wear' 'Field-Tested' 'Well-Worn' 'Battle-Scarred'; var data = prices : weapon : "AWP" cached : false skins : 'Asiimov' 'BOOM' 'Man-o\'-war' skinData : {} var { var promises = ; theDataskins; return Q;}
NOTE:
Capitalization is important for passed in values. If you are unsure of the exact name/spelling/capitilization/punctuation of a weapon and/or skin I highly recommend checking the community market as a reference or turning off strictNameMode
by using csgomarket.strictNameMode = false;
. Turning strictNameMode
off will attempt to match a passed in string with a Weapon
or Knife
that exists in the game if the string is not formatted correctly. Does not affect passed in Key
, Sticker
, or Skin
names.
Main goals to add in the near future:
- Method for all wears given a particular gun and skin or knife and skin.
This module is still under-development and this is just the first iteration.
If you have any suggestions I am open to add additional functionality! I'd like to keep it small, but I'd love feedback. Email me at nick.b.duncan@gmail.com