Ejemplo n.º 1
0
        private static string GetUrlRequest(AppId.AppName app)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/summarize_buy_orders/");
            urlCreator.AppendUrl($"&app_id={(int)app}");

            return(urlCreator.ReadUrl());
        }
Ejemplo n.º 2
0
        public void RelistAndDelistItemTest()
        {
            AppId.AppName         app  = AppId.AppName.CounterStrikGlobalOffensive;
            BitSkinsInventoryItem item = null;

            foreach (AppId.AppName appId in Enum.GetValues(typeof(AppId.AppName)))
            {
                AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, 1);
                if (accountInventorys.BitSkinsInventory.TotalItems > 0)
                {
                    item = accountInventorys.BitSkinsInventory.BitSkinsInventoryItems[0];
                    app  = appId;
                    break;
                }
            }

            if (item != null)
            {
                string itemId    = item.ItemIds[0];
                double itemPrice = item.Prices[0];
                Console.WriteLine(item.MarketHashName + " " + itemPrice);
                List <DelistedItem> delistedItems = DelistFromSale.DelistItem(app, new List <string> {
                    itemId
                });
                Assert.AreEqual(itemId, delistedItems[0].ItemId);
                List <RelistedItem> relistedItems = RelistForSale.RelistItem(app, new List <string> {
                    itemId
                }, new List <double> {
                    itemPrice
                });
            }

            Assert.IsTrue(true);
        }
Ejemplo n.º 3
0
        private static string GetUrlRequest(AppId.AppName app)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/get_all_item_prices/");
            urlCreator.AppendUrl($"&app_id={(int)app}");

            return(urlCreator.ReadUrl());
        }
Ejemplo n.º 4
0
        public void SellItemTest()
        {
            AppId.AppName      app  = AppId.AppName.CounterStrikGlobalOffensive;
            SteamInventoryItem item = null;

            foreach (AppId.AppName appId in Enum.GetValues(typeof(AppId.AppName)))
            {
                AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, 1);
                if (accountInventorys.SteamInventory.TotalItems > 0)
                {
                    item = accountInventorys.SteamInventory.SteamInventoryItems[0];
                    app  = appId;
                    break;
                }
            }

            if (item != null)
            {
                string itemId    = item.ItemIds[0];
                double itemPrice = item.SuggestedPrice.Value * 5;
                InformationAboutSale information = Sale.SellItem(app, new List <string> {
                    itemId
                }, new List <double> {
                    itemPrice
                });
                string id = information.SoldItems[0].ItemId;
                Assert.AreEqual(itemId, id);
            }

            Assert.IsTrue(true);
        }
Ejemplo n.º 5
0
        private static string GetUrlRequest(AppId.AppName app, int page)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/get_buy_history/");
            urlCreator.AppendUrl($"&page={page}");
            urlCreator.AppendUrl($"&app_id={(int)app}");

            return(urlCreator.ReadUrl());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Allows you to retrieve the entire price database used at BitSkins.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <returns>List of price database's items.</returns>
        public static List <ItemPrice> GetAllItemPrices(AppId.AppName app)
        {
            string           urlRequest  = GetUrlRequest(app);
            string           result      = Server.ServerRequest.RequestServer(urlRequest);
            List <ItemPrice> itemsPrices = ReadItemsPrices(result);

            return(itemsPrices);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Allows you to retrieve basic price data for items currently on sale at BitSkins.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <returns>List of items currently on sale at BitSkins.</returns>
        public static List <MarketItem> GetMarketData(AppId.AppName app)
        {
            string            urlRequest  = GetUrlRequest(app);
            string            result      = Server.ServerRequest.RequestServer(urlRequest);
            List <MarketItem> marketItems = ReadMarketItems(result);

            return(marketItems);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Allows you to retrieve a summary of all market buy orders. Results include your own buy orders, where applicable.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <returns>List of items of buy order.</returns>
        public static List <ItemBuyOrder> SummarizeBuyOrders(AppId.AppName app)
        {
            string urlRequest = GetUrlRequest(app);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <ItemBuyOrder> itemsBuyOrder = ReadItemsBuyOrder(result);

            return(itemsBuyOrder);
        }
Ejemplo n.º 9
0
        private static string GetUrlRequestForAllBuyOrders(AppId.AppName app, string marketHashName)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/cancel_all_buy_orders/");
            urlCreator.AppendUrl($"&app_id={(int)app}");
            urlCreator.AppendUrl($"&market_hash_name={marketHashName}");

            return(urlCreator.ReadUrl());
        }
Ejemplo n.º 10
0
        private static string GetUrlRequest(AppId.AppName app, string marketHashName)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/get_steam_price_data/");
            urlCreator.AppendUrl($"&app_id={(int)app}");
            urlCreator.AppendUrl($"&market_hash_name={marketHashName}");

            return(urlCreator.ReadUrl());
        }
Ejemplo n.º 11
0
        public void SummarizeBuyOrdersTest()
        {
            AppId.AppName app = AppId.AppName.CounterStrikGlobalOffensive;

            SummationBuyOrders.SummarizeBuyOrders(app);

            Assert.IsTrue(true);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Allows you to delist an active sale item.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="itemIds">List of item IDs.</param>
        /// <returns>List of delisted items.</returns>
        public static List <DelistedItem> DelistItem(AppId.AppName app, List <string> itemIds)
        {
            CheckParameters(itemIds);
            string urlRequest = GetUrlRequest(app, itemIds);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <DelistedItem> delistedItems = ReadDelistedItems(result);

            return(delistedItems);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Allows you to retrieve data for specific Item IDs that are currently on sale.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="itemIds">List of item ids. Upto 250 item IDs.</param>
        /// <returns>Specific items on sale on BitSkins.</returns>
        public static SpecificItems GetSpecificItemsOnSale(AppId.AppName app, List <string> itemIds)
        {
            CheckParameters(itemIds);
            string        urlRequest    = GetUrlRequest(app, itemIds);
            string        result        = Server.ServerRequest.RequestServer(urlRequest);
            SpecificItems specificItems = ReadSpecificItems(result);

            return(specificItems);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Allows you to cancel upto 999 active buy orders.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="buyOrderIds">Up to 999 buy order IDs.</param>
        /// <returns>Canceled buy orders.</returns>
        public static CanceledBuyOrders CancelBuyOrders(AppId.AppName app, List <string> buyOrderIds)
        {
            CheckParametersForCancelBuyOrders(buyOrderIds);
            string            urlRequest        = GetUrlRequestForBuyOrders(app, buyOrderIds);
            string            result            = Server.ServerRequest.RequestServer(urlRequest);
            CanceledBuyOrders canceledBuyOrders = ReadCanceledBuyOrders(result);

            return(canceledBuyOrders);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Allows you to retrieve the expected place in queue for a new buy order without creating the buy order.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="name">The name of the item you want to purchase.</param>
        /// <param name="price">The price at which you want to purchase the item.</param>
        /// <returns>Expected place in queue.</returns>
        public static int?GetExpectedPlaceInQueue(AppId.AppName app, string name, double price)
        {
            CheckParameters(name, price);
            string urlRequest           = GetUrlRequest(app, name, price);
            string result               = Server.ServerRequest.RequestServer(urlRequest);
            int?   expectedPlaceInQueue = ReadExpectedPlaceInQueue(result);

            return(expectedPlaceInQueue);
        }
Ejemplo n.º 16
0
        public void GetMarketBuyOrdersTest()
        {
            AppId.AppName app  = AppId.AppName.CounterStrikGlobalOffensive;
            string        name = "CS:GO Weapon Case 2";

            MarketBuyOrders.GetMarketBuyOrders(app, name, 1);

            Assert.IsTrue(true);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Allows you to change the price on an item currently on sale.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="itemIds">Item IDs to modify.</param>
        /// <param name="itemPrices">New item prices, in order of item_ids.</param>
        /// <returns>List of modified items.</returns>
        public static List <ModifiedItem> ModifySale(AppId.AppName app, List <string> itemIds, List <double> itemPrices)
        {
            CheckParameters(itemIds, itemPrices);
            string urlRequest = GetUrlRequest(app, itemIds, itemPrices);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <ModifiedItem> modifiedItems = ReadModifiedItems(result);

            return(modifiedItems);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Allows you to retrieve your history of bought items on BitSkins.
        /// Defaults to 30 items per page, with most recent appearing first.
        /// </summary>
        /// <param name="app">Iinventory's game id.</param>
        /// <param name="page">Page number.</param>
        /// <returns>List of buy history records.</returns>
        public static List <BuyHistoryRecord> GetBuyHistory(AppId.AppName app, int page)
        {
            CheckParameters(page);
            string urlRequest = GetUrlRequest(app, page);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <BuyHistoryRecord> buyHistoryRecords = ReadBuyHistoryRecors(result);

            return(buyHistoryRecords);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Allows you to retrieve bought/sold/listed item history.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="page">Page number.</param>
        /// <param name="names">Item names. (optional)</param>
        /// <param name="resultsPerPage">Results per page.</param>
        /// <returns>List of item's history records.</returns>
        public static List <ItemHistoryRecord> GetItemHistory(AppId.AppName app, int page, List <string> names, ResultsPerPage resultsPerPage)
        {
            CheckParameters(page);
            string urlRequest = GetUrlRequest(app, page, names, resultsPerPage);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <ItemHistoryRecord> itemHistoryRecords = ReadItemHistoryRecords(result);

            return(itemHistoryRecords);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Allows you to cancel all buy orders for a given item name.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="marketHashName">The item name.</param>
        /// <returns>Canceled buy orders.</returns>
        public static CanceledBuyOrders CancelAllBuyOrders(AppId.AppName app, string marketHashName)
        {
            CheckParametersCancelAllBuyOrders(marketHashName);
            string            urlRequest        = GetUrlRequestForAllBuyOrders(app, marketHashName);
            string            result            = Server.ServerRequest.RequestServer(urlRequest);
            CanceledBuyOrders canceledBuyOrders = ReadCanceledBuyOrders(result);

            return(canceledBuyOrders);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Returns a paginated list of items that need their prices reset.
        /// Items need prices reset when Steam changes tracker so BitSkins are unable to match specified prices to the received items
        /// when you list them for sale.
        /// Upto 30 items per page.
        /// Items that need price resets always have the reserved price of 4985.11.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="page">Page number.</param>
        /// <returns>List of reset price items.</returns>
        public static List <ResetPriceItem> GetResetPriceItems(AppId.AppName app, int page)
        {
            CheckParameters(page);
            string urlRequest = GetUrlRequest(app, page);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <ResetPriceItem> resetPriceItems = ReadResetPriceItems(result);

            return(resetPriceItems);
        }
Ejemplo n.º 22
0
        private static string GetUrlRequest(AppId.AppName app, string name, double price)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/get_expected_place_in_queue_for_new_buy_order/");
            urlCreator.AppendUrl($"&app_id={(int)app}");
            urlCreator.AppendUrl($"&name={name}");
            urlCreator.AppendUrl($"&price={price.ToString(System.Globalization.CultureInfo.InvariantCulture)}");

            return(urlCreator.ReadUrl());
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Allows you to list an item for sale. This item comes from your Steam inventory.
        /// If successful, bots will ask you to trade in the item you want listed for sale.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="itemIds">List of item IDs from your Steam inventory.</param>
        /// <param name="itemPrices">List of prices for each item ID you want to list for sale.</param>
        /// <returns>Info about sale.</returns>
        public static InformationAboutSale SellItem(AppId.AppName app, List <string> itemIds, List <double> itemPrices)
        {
            CheckParameters(itemIds, itemPrices);
            string urlRequest = GetUrlRequest(app, itemIds, itemPrices);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            InformationAboutSale informationAboutSale = ReadInformationAboutSale(result);

            return(informationAboutSale);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Allows you to re-list a delisted/purchased item for sale.
        /// Re-listed items can be sold instantly, where applicable.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="itemIds">List of item IDs.</param>
        /// <param name="itemPrices">Prices for the item Ids.</param>
        /// <returns>List of relisted items.</returns>
        public static List <RelistedItem> RelistItem(AppId.AppName app, List <string> itemIds, List <double> itemPrices)
        {
            CheckParameters(itemIds, itemPrices);
            string urlRequest = GetUrlRequest(app, itemIds, itemPrices);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <RelistedItem> relistedItems = ReadRelistedItems(result);

            return(relistedItems);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Allows you to retrieve upto 5 pages worth of recent sale data for a given item name.
        /// These are the recent sales for the given item at BitSkins, in descending order.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="marketHashName">The item's name.</param>
        /// <param name="page">The page number. From 1 to 5.</param>
        /// <returns>List of item's recent sales.</returns>
        public static List <ItemRecentSale> GetRecentSaleInfo(AppId.AppName app, string marketHashName, int page)
        {
            CheckParameters(marketHashName, page);
            string urlRequest = GetUrlRequest(app, marketHashName, page);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <ItemRecentSale> itemRecentSales = ReadItemRecentSales(result);

            return(itemRecentSales);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Allows you to retrieve all market orders by all buyers (except your own) that need fulfillment.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="name">The item name for which you seek buy orders.</param>
        /// <param name="page">Page number.</param>
        /// <returns>List of market buy orders.</returns>
        public static List <MarketBuyOrder> GetMarketBuyOrders(AppId.AppName app, string name, int page)
        {
            CheckParameters(name, page);
            string urlRequest = GetUrlRequest(app, name, page);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            List <MarketBuyOrder> marketBuyOrders = ReadMarketBuyOrders(result);

            return(marketBuyOrders);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Allows you to retrieve raw Steam Community Market price data for a given item.
        /// You can use this data to create your own pricing algorithm if you need it.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="marketHashName">The item's name.</param>
        /// <returns>Raw Steam Market price data for a given item.</returns>
        public static SteamItemRawPriceData GetRawPriceData(AppId.AppName app, string marketHashName)
        {
            CheckParameters(marketHashName);
            string urlRequest = GetUrlRequest(app, marketHashName);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            SteamItemRawPriceData steamItemRawPriceData = ReadSteamItemRawPrice(result);

            return(steamItemRawPriceData);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Allows you to create a buy order for a single item.
        /// Buy orders are executed within 30 seconds if someone lists an item for sale that is at or below your buy order price.
        /// Funds are not withheld because of pending buy orders,
        /// but will be automatically cancelled if your account has insufficient funds to execute a buy order when an eligible item is up for sale.
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="name">The name of the item you want to purchase.</param>
        /// <param name="price">The price at which you want to purchase the item.</param>
        /// <param name="quantity">Number of buy orders to create at this price for this item.</param>
        /// <returns>List of created buy orders.</returns>
        public static List <BuyOrder> CreateBuyOrder(AppId.AppName app, string name, double price, int quantity)
        {
            CheckParameters(name, price, quantity);
            string          urlRequest       = GetUrlRequest(app, name, price, quantity);
            string          result           = Server.ServerRequest.RequestServer(urlRequest);
            List <BuyOrder> createdBuyOrders = ReadCreatedBuyOrders(result);

            return(createdBuyOrders);
        }
Ejemplo n.º 29
0
        public void GetExpectedPlaceInQueueTest()
        {
            AppId.AppName app   = AppId.AppName.CounterStrikGlobalOffensive;
            string        name  = "CS:GO Weapon Case 2";
            double        price = 0.01;

            PlaceInQueue.GetExpectedPlaceInQueue(app, name, price);

            Assert.IsTrue(true);
        }
Ejemplo n.º 30
0
        private static string GetUrlRequest(AppId.AppName app, List <string> itemIds)
        {
            const string delimiter = ",";

            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/delist_item/");
            urlCreator.AppendUrl($"&app_id={(int)app}");
            urlCreator.AppendUrl($"&item_ids={itemIds.ToStringWithDelimiter(delimiter)}");

            return(urlCreator.ReadUrl());
        }