01blockchain = include_lib("/lib/blockchain.so")
02if not blockchain then exit("Error: Missing blockchain.so library in the /lib")
03
04import_code("/home/me/market/libs/listLib.src")
05import_code("/home/me/market/libs/offersLib.src") import_code("/home/me/market/libs/coinLib.src") import_code("/home/me/market/libs/coinsLib.src")
09my_coin = {"user": "dead", "password": "dead", "name": "moneda"}
10
11wallet = blockchain.login_wallet("dead", "dead")
12
13Coin.blockchain = blockchain
14Coin.wallet = wallet
15Coins.blockchain = blockchain
16Coins.wallet = wallet
17
18Coins.init()
19
20for coin in Coins.sort
21 print(coin.name)
22 print("website: " + coin.website)
23 print("average price(NOT ACCURATE AT ALL):" + coin.average_price)
24 print("last sold price: " + coin.price)
25 print("total coins mined: " + coin.mined)
26 print("total of completed transactions: " + coin.history.len)
27 print("sell offers: " + coin.offers.sells.len)
28 print("buy offers: " + coin.offers.buys.len)
29 if coin.offers.sells.len > 0 then
30 f = function(offer)
31 return offer["amount"]
32 end function
33 total_coins = map(coin.offers.sells, @f).sum
34 print(total_coins + " for sale starting at $" + coin.offers.sells_min["price"])
35 out = ["price quantity"]
36 for i in coin.offers.sells.sort("price")
37 out.push(i["price"] + " " + i["amount"])
38 end for
39 print(format_columns(out.join(char(10))))
40 end if
41 if coin.offers.buys.len > 0 then
42 f = function(offer)
43 return offer["amount"]
44 end function
45 total_coins = map(coin.offers.buys, @f).sum
46 print(total_coins + " requests to buy at $" + coin.offers.buys_max["price"] + " or lower")
47 out = ["price quantity"]
48 buys = coin.offers.buys.sort("price")
49 buys.reverse
50 for i in buys
51 out.push(i["price"] + " " + i["amount"])
52 end for
53 print(format_columns(out.join(char(10))))
54 end if
55 print(" ")
56end for