forked from 0rtis/dfktools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auction_example.py
30 lines (22 loc) · 1003 Bytes
/
auction_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import logging
import sys
import auctions.sale.sale_auctions as sales
import auctions.rent.rent_auctions as rental
if __name__ == "__main__":
log_format = '%(asctime)s|%(name)s|%(levelname)s: %(message)s'
logger = logging.getLogger("DFK-auctions")
logger.setLevel(logging.DEBUG)
logging.basicConfig(level=logging.INFO, format=log_format, stream=sys.stdout)
rpc_server = 'https://api.harmony.one'
logger.info("Using RPC server " + rpc_server)
graphql = 'http://graph3.defikingdoms.com/subgraphs/name/defikingdoms/apiv5'
auctions = sales.get_recent_open_auctions(graphql, 10)
logger.info("Recent sale auctions:")
for auction in auctions:
logger.info(str(auction))
# sale.bid_hero(hero_id, ether2wei(100), prv_key, nonce, gas_price_gwei, rpc_server, logger)
logger.info("\n")
logger.info("Recent rental auctions:")
auctions = rental.get_recent_open_auctions(graphql, 10)
for auction in auctions:
logger.info(str(auction))