[암호화폐] 그것이 알고 싶다!! token 거래내역
본인의 거래 내역은 간단하게 조회가 됩니다만, scot 토큰 전체 거래 내역을 확인해보고 싶은데 방법이 없군요. 이걸 꼭 보아야할 필요가 있는가에 대한 의문도 들기는 하지만 궁금하니 확인을 해 봅니다.
기본 아이디어는 원하는 토큰의 홀더를 대상으로 최근에 해당 토큰을 거래한 이력이 있으면 block 번호 순으로 출력하는 것입니다. 그런데 이게 생각보다 잘 안됩니다.
우선 기본적으로 필요한 함수를 먼저 설명합니다.
가장 마지막 블록에 대한 정보를 얻는 방법입니다. 가장 최근 블럭 번호에 검색하고자 하는 시간 범위에 있는 블록번호를 계산합니다.
latest_block = api.get_latest_block_info()
end_block = latest_block['blockNumber'] - TR_EXAMIN_PERIOD*60*20
특정 토큰의 홀더 정보와 특정 사용자의 최근 거래 내역을 구하는 방법입니다.
balances = api.find("tokens","balances",{ 'symbol': symbol}) # holder info
rets = api.get_history(balance['account'], symbol)
이렇게 얻은 거래 내역을 바탕으로 시간 범위안에 있는 블록에 대하여 market에서 주고 받은 내역에 대하여 검사를 하면 됩니다.
for ret in rets :
try:
if (int(ret['block']) > end_block) :
if (ret['from'] == 'market' or ret['to'] == 'market') :
그런데 아직은 원하는 값을 얻을 수가 없습니다. 뭔가를 놓친 것 같은데, 그것이 무엇일지 확인 중입니다.
jcar토큰,
8월 구독 보팅입니다.
날마다 행복한 날,
날마다 의미있는 하루
되시길 바랍니다. ^^
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.401 which ranks you at #2448 across all Steem accounts.
Your rank has not changed in the last three days.
In our last Algorithmic Curation Round, consisting of 147 contributions, your post is ranked at #64.
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server