[암호화폐] Upbit 자동 매매

in #sct5 years ago (edited)

일전에 upbit 자동 매매에 대하여 글을 올린 적이 있는데요. 짬짬히 작업을 하여 기본적인 틀은 만들었습니다. 그 과정을 기술합니다.


우선 Upbit API를 사용하기 위해서는 Upbit 계정이 있어야 합니다. 계정을 만드신 후 아래 사이트에 가시면 Open API 키를 발급받아야 합니다.
https://www.upbit.com/mypage/open_api_management

다음은 Upbit Open API 문서를 보아야 합니다. 최신 버전은 아래 사이트에서 확인하실 수 있습니다.
https://docs.upbit.com/v1.0.3/reference

능력이 있으신 개발자는 Open API문서만 보면 개발이 가능하겠지만, 이런 API를 class로 잘 정리한 코드가 github에 있을 겁니다. 그래서 github에 가서 "upbit python"로 찾아봅니다. 여러 개발 프로젝트가 검색이 되는데 저는 아래 두 project를 다운 받아서 확인해보았습니다

https://github.com/sharebook-kr/pyupbit
https://github.com/inasie/upbitpy

일전에 작업을 할 때는 inasie 님 코드를 이용했었는데요. 약간 코드가 복잡한 면이 있어서 sharebook-kr님의 코드를 이용해 보았습니다. 그런데 아쉽게도 upbit API에서는 주문 체결 내역을 알려주는 API가 없더군요. 대신에 주문 내역을 알려주는 API는 있습니다.

그래서 Open API 문서를 바탕으로 주문 내역을 알려준는 함수를 만들었습니다

    def orders_status(self, ticker):
        '''
        주문 상태
        :param ticker: 마켓 티커
        :return:
        '''
        try:
            url = "https://api.upbit.com/v1/orders"
            data = {"market": ticker,
                    "page" : 1
                    }
            headers = self._request_headers(data)
            return _send_get_request(url, headers=headers, params=data)
        except Exception as x:
            print(x.__class__.__name__)
            return None

주문 내역을 읽어서 자동매매를 할 수 있는 방법을 고민해 보아야 할 것 같습니다. 고민 중!!!

Sort:  

와 정말 대단합니다. 존경스럽네요.

다른 분이 만든 것 보고 수정한 건데요. 처음에 github에 올리신 분들이 대단하신 거지요.

오훗 멋지십니다 ㅎ
자동만큼 좋은게 없죠..ㅎ 감정없이 해야하니깐..ㅎ

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 600K 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 3.582 which ranks you at #5595 across all Steem accounts.
Your rank has dropped 12 places in the last three days (old rank 5583).

In our last Algorithmic Curation Round, consisting of 181 contributions, your post is ranked at #106.

Evaluation of your UA score:
  • You're on the right track, try to gather more followers.
  • The readers like your work!
  • You have already shown user engagement, try to improve it further.

Feel free to join our @steem-ua Discord server

스코판이 생긴후 스팀잇이 점점 알차지는거 같습니다 ^^
감사합니다!

그런데 매수 매도 물량이 순간 몰릴 때 이게 제대로 작동을 할지가 의문이에요.
수동으로 거래 눌러도 렉 심해서 정상 처리도 안되고 입력한 값과 전혀 다른 값 처리 또는 지연으로 인해 골드타임 놓치기 부지기 수라서 업비트 API 한번 자동으로 시점 거래 프로그램을 저도 만들어 보고 싶긴 하는데 수동 거래도 문제점이 있는데 자동거래는 아직은 좀 아닌 것 같다는 생각이 드네요.

실시간으로 매매하는 것이 아니라 매수/매도 구간 정해놓고 사고 파는 것을 자동으로 할려고 합니다. 주문하는 순간에 서버가 터지면 작동이 안될 것 같기는 합니다.

Congratulations @tradingideas! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published a post every day of the week
You received more than 35000 upvotes. Your next target is to reach 40000 upvotes.

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 STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

요즘즐어 자고 나면
새로운 코인이 나오는 것 같습니다.
거기에 자동매매까지 실현 된다면
코인의 춘추전국시대가 아닐까요? ㅎㅎ

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70753.86
ETH 3589.34
USDT 1.00
SBD 4.75