コード例 #1
0
ファイル: test_graph.py プロジェクト: zkrat/termgraph
    def test_candle_half_1(self):
        c = Candle(0, 4, 1.5, 3.5)
        g = CandleStickGraph([c], 4)
        drawn_string = g.draw(False)

        lines = drawn_string.split("\n")
        first_candle = [line[9] for line in lines[1:-1]]
        self.assertEquals(CandleStickGraph.SYMBOL_HALF_TOP, first_candle[0])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[1])
        self.assertEquals(CandleStickGraph.SYMBOL_HALF_BOTTOM, first_candle[2])
        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[3])
コード例 #2
0
ファイル: test_graph.py プロジェクト: zkrat/termgraph
    def test_candle_half_3(self):
        c = Candle(1.2, 4, 1.5, 3.8)
        c_fake = Candle(0, 4, 0, 0)
        g = CandleStickGraph([c, c_fake], 4)
        drawn_string = g.draw(False)

        lines = drawn_string.split("\n")
        first_candle = [line[9] for line in lines[1:-1]]
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[0])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[1])
        self.assertEquals(CandleStickGraph.SYMBOL_HALF_BOTTOM, first_candle[2])
        self.assertEquals(CandleStickGraph.SYMBOL_NOTHING, first_candle[3])
コード例 #3
0
ファイル: test_graph.py プロジェクト: zkrat/termgraph
    def test_candle_int_4(self):
        c = Candle(0, 4, 1, 3)
        g = CandleStickGraph([c], 4)
        drawn_string = g.draw(False)

        lines = drawn_string.split("\n")
        first_candle = [line[9] for line in lines[1:-1]]

        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[0])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[1])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[2])
        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[3])
コード例 #4
0
ファイル: test_graph.py プロジェクト: zkrat/termgraph
    def test_candle_frac_8(self):
        c = Candle(0, 4, 1.5, 3.5)
        g = CandleStickGraph([c], 8)
        drawn_string = g.draw(False)

        lines = drawn_string.split("\n")
        first_candle = [line[9] for line in lines[1:-1]]
        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[0])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[1])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[2])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[3])
        self.assertEquals(CandleStickGraph.SYMBOL_CANDLE, first_candle[4])
        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[5])
        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[6])
        self.assertEquals(CandleStickGraph.SYMBOL_STICK, first_candle[7])
コード例 #5
0
from graph import CandleStickGraph
from example_data import example_data
from time import sleep

for i in range(1, len(example_data)):
    g = CandleStickGraph(example_data[0:i], 55)
    print(g.draw())
    sleep(0.1)