[개발] 스몬 카드 투자[8]
스몬 카드 투자시 토너먼트에 참가하여 상금을 받는 것도 중요한 부분입니다. 토너먼트 상금이 높은 경우에는 게임해서 버는 DEC 보다 훨씬 많이 받을 수 있기 때문입니다.
최근 상금을 받은 토너먼트 5개를 출력해주는 기능을 추가하였습니다.
https://repl.it/@zonemultiwhs/smonall
menu 6번이고 id를 함께 입력하면 됩니다. 실행 결과입니다.
지난 토너먼트 리스트를 받는 API는 다음과 같습니다.
https://steemmonsters.com/tournaments/completed
이 API를 이용하여 지난 토너먼트의 id를 구한 후 특정 토너먼트의 결과는 아래 API를 사용하면 됩니다.
https://steemmonsters.com/tournaments/find?id=8b2fc297214ac0cd9063b6a36a60f1097650788f
각 토너먼트 정보에는 payers 정보가 있으며, 등수 순으로 저장되어 있습니다. 만약 본인이 상금을 받았으면 prize 항목에 None이 아닌 값이 저장되어 있습니다. 값은 string으로 저장되어 있으므로, split 함수를 이용하여 분리한 후 float 함수로 변환하여 사용하면 됩니다.
def find_prize(tour, user) :
path = 'tournaments/find?id='+tour['id']
tourna_info = get_data_from_sm(path)
for winner in tourna_info['players'] :
if winner['player'] == user :
if winner['prize'] == None:
return 0
print(format(winner['prize'], "16s"), tour['name'])
amount = winner['prize'].split(' ')
return float(amount[0])
return 0
토너먼트 자주 참석해서 DEC 상금을 많이 받으시기 바랍니다.
jcar토큰 9월 구독 보팅입니다.
좋은 하루 보내세요. ^^
Congratulations @tradingideas! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOPTo support your work, I also upvoted your post!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Thank you for your continued support towards JJM. For each 1000 JJM you are holding, you can get an additional 1% of upvote. 10,000JJM would give you a 11% daily voting from the 700K SP virus707 account.
Hi @tradingideas!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 4.398 which ranks you at #2480 across all Steem accounts.
Your rank has not changed in the last three days.
In our last Algorithmic Curation Round, consisting of 108 contributions, your post is ranked at #88.
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server