Files
crash.src
- import_code("/home/me/market/listLib.src")
- Offers = {}
- Offers.init = function(raw_offers)
- self.raw_offers = raw_offers
- end function
- Offers.list = function()
- list = []
- for offer in to_list(self.raw_offers)
- wallet_id = offer[0]
- order = offer[1]
-
- type = order[0]
- amount = order[1]
- price = order[2]
-
- new_offer = {}
- new_offer["wallet_id"] = wallet_id
- new_offer["type"] = type
- new_offer["amount"] = amount
- new_offer["price"] = price
-
- list.push(new_offer)
- end for
- return list
- end function
- Offers.buys = function()
- f = function(offer)
- return offer["type"] == "Buy"
- end function
- return select(self.list, @f)
- end function
- Offers.buys_min = function()
- if self.buys.len == 0 then return null
- return self.buys.sort("price")[0]
- end function
- Offers.buys_max = function()
- if self.buys.len == 0 then return null
- return self.buys.sort("price")[-1]
- end function
- Offers.buys_list = function()
- f = function(offer)
- return [offer["price"], offer["amount"]]
- end function
- return map(self.buys, @f)
- end function
- Offers.sells = function()
- f = function(offer)
- return offer["type"] == "Sell"
- end function
- return select(self.list, @f)
- end function
- Offers.sells_list = function()
- f = function(offer)
- return [offer["price"], offer["amount"]]
- end function
- return map(self.sells, @f)
- end function
- Offers.sells_min = function()
- if self.sells.len == 0 then return null
- return self.sells.sort("price")[0]
- end function
- Offers.sells_max = function()
- if self.sells.len == 0 then return null
- return self.sells.sort("price")[-1]
- end function
- Offers.len = function()
- return self.list.len
- end function
- Coin = {}
- Coin.wallet = login_wallet("dead", "kek")
- Coin.init = function(name, wallet)
- self.name = name
- end function
- Coin.offers = function()
- offers = new Offers
- offers.init(self.wallet.get_global_offers(self.name))
- return offers
- end function
- get_min_avaliable_value = function(list)
- min = 5
- while true
- if list.indexOf(min) then
- min = min + 1
- else
- return min
- end if
- end while
- end function
- get_max_avaliable_value = function(list, value)
- max = value
- while true
- if list.indexOf(max) then
- max = max - 1
- else
- return max
- end if
- end while
- end function
- wallets = [login_wallet("dead", "kek"), login_wallet("testeh4x", "123")]
- crash = ["TornadoCash", "BTC"]
- bump = ["1337coin"]
- for coin_name in crash
- wallets[0].cancel_pending_trade(coin_name)
- wallets[1].cancel_pending_trade(coin_name)
- coin_amount = 1
- coin = new Coin
- coin.init(coin_name)
-
- buys = coin.offers.buys
- f = function(i)
- return i["price"]
- end function
- buys = map(buys, @f)
-
- price = get_min_avaliable_value(buys)
- print(price)
-
- print("crashing " + coin.name + " coin")
- for i in [1,2,3,4]
price = floor(rnd * 10)
- wallets[0].sell_coin(coin_name, coin_amount, price)
- wallets[1].buy_coin(coin_name, coin_amount, price)
- wallets[1].sell_coin(coin_name, coin_amount, price)
- wallets[0].buy_coin(coin_name, coin_amount, price)
- end for
- end for
- //exit("a")
- for coin_name in bump
- wallets[0].cancel_pending_trade(coin_name)
- wallets[1].cancel_pending_trade(coin_name)
- coin_amount = 1
- coin = new Coin
- coin.init(coin_name)
-
- buys = coin.offers.buys
- f = function(i)
- return i["price"]
- end function
- buys = map(buys, @f)
-
- print("bump " + coin.name + " coin")
- for i in [1,2,3,4]
- price = get_max_avaliable_value(buys, 300)
off_set = floor(rnd * 50)
price = price - off_set
- wallets[0].cancel_pending_trade(coin_name)
- wallets[1].cancel_pending_trade(coin_name)
- wallets[0].sell_coin(coin_name, coin_amount, price)
- wallets[1].buy_coin(coin_name, coin_amount, price)
- wallets[1].sell_coin(coin_name, coin_amount, price)
- wallets[0].buy_coin(coin_name, coin_amount, price)
- end for
- end for