ipython의 prompt에서 bitcoin의 가격을 보려고했습니다.

bitcoin price api



code


from IPython.terminal.prompts import Prompts, Token
from exchanges.bitfinex import Bitfinex
import os

class MyPrompt(Prompts):
    def in_prompt_tokens(self, cli=None):
        return [(Token, os.getcwd()),
                (Token.Prompt, ' ' + str(Bitfinex().get_current_price()) + ' >>>')]

ip = get_ipython()
ip.prompts = MyPrompt(ip)



conclusion



cool but it is so slow!.
and if we have to show the price on screen, the tmux status bar might be a better place.

좋은 웹페이지 즐겨찾기