Open main menu
Posts
Gists
Guilds
Users
Decipher
Docs
Open user menu
Log in
Sign up
Create a new gist
Posts
Gists
Guilds
Users
Decipher
Docs
Files
market.src
market.src
blockchain = include_lib("/lib/blockchain.so")
if not blockchain then exit("Error: Missing blockchain.so library in the /lib")
import_code("/home/me/market/listLib.src")
import_code("/home/me/market/offersLib.src") // depends on list
import_code("/home/me/market/coinLib.src") // depends on offers, list
import_code("/home/me/market/coinsLib.src") // depends on coin, list
import_code("/home/me/market/li
bs/li
stLib.src")
import_code("/home/me/market/
libs/
offersLib.src") // depends on list
import_code("/home/me/market/
libs/
coinLib.src") // depends on offers, list
import_code("/home/me/market/
libs/
coinsLib.src") // depends on coin, list
my_coin = {"user": "dead", "password": "dead", "name": "moneda"}
wallet = login_wallet("deadlock", "dead")
Coin.blockchain = blockchain
Coin.wallet = wallet
Coins.blockchain = blockchain
Coins.wallet = wallet
Coins.init()
for coin in Coins.sort
print(coin.name)
print("average price(NOT ACCURATE AT ALL):" + coin.average_price)
print("last sold price: " + coin.price)
print("total coins mined: " + coin.mined)
print("total of completed transactions: " + coin.history.len)
print("sell offers: " + coin.offers.sells.len)
print("buy offers: " + coin.offers.buys.len)
if coin.offers.sells.len > 0 then
f = function(offer)
return offer["amount"]
end function
total_coins = map(coin.offers.sells, @f).sum
print(total_coins + " for sale starting at $" + coin.offers.sells_min["price"])
out = ["price quantity"]
for i in coin.offers.sells.sort("price")
out.push(i["price"] + " " + i["amount"])
end for
print(format_columns(out.join(char(10))))
end if
if coin.offers.buys.len > 0 then
f = function(offer)
return offer["amount"]
end function
total_coins = map(coin.offers.buys, @f).sum
print(total_coins + " requests to buy at $" + coin.offers.buys_max["price"] + " or lower")
out = ["price quantity"]
buys = coin.offers.buys.sort("price")
buys.reverse
for i in buys
out.push(i["price"] + " " + i["amount"])
end for
print(format_columns(out.join(char(10))))
end if
print(" ")
end for