Пример #1
0
def netlist_plotInstructions(header: List[str], values):
    """
    Describe how to plot the information.
    tsp.do_plot() calls this

    :param: header: List[str] holding 'Tick', 'Second', ...
    :param: values: 2d array of float [tick_i, valuetype_i]
    :return: x_label: str -- e.g. "Day", "Month", "Year"
    :return: x: List[float] -- x-axis info on how to plot
    :return: y_params: List[YParam] -- y-axis info on how to plot
    """
    x_label = "Day"
    x = arrayToFloatList(values[:, header.index(x_label)])

    y_params = [
        YParam(
            [
                "publisher_OCEAN_networth",
                "consumer_OCEAN_networth",
                "stakerSpeculator_OCEAN_networth",
                "speculator_OCEAN_networth",
                "maliciousPublisher_OCEAN_networth",
            ],
            [
                "publisher",
                "consumer",
                "stakerSpeculator",
                "speculator",
                "maliciousPublisher",
            ],
            "Agents OCEAN networth",
            LINEAR,
            MULT1,
            COUNT,
        ),
        YParam(
            [
                "publisher_OCEAN",
                "consumer_OCEAN",
                "stakerSpeculator_OCEAN",
                "speculator_OCEAN",
                "maliciousPublisher_OCEAN",
            ],
            [
                "publisher", "consumer", "staker", "speculator",
                "maliciousPublisher"
            ],
            "Agents OCEAN wallet",
            LINEAR,
            MULT1,
            DOLLAR,
        ),
        YParam(["n_pools"], ["# pools"], "n_pools", LINEAR, MULT1, COUNT),
    ]

    return (x_label, x, y_params)
Пример #2
0
def test_yparam2_yscale():
    for (y_scale, y_scale_str) in [(LINEAR, "LINEAR"), (LOG, "LOG"), (BOTH, "BOTH")]:

        yparam = YParam(["foo1"], ["foo 1"], "Foo 1", y_scale, MULT1, COUNT)
        assert yparam.y_scale == y_scale
        assert yparam.y_scale_str == y_scale_str

    BAD_VALUE = 99
    yparam = YParam(["foo1"], ["foo 1"], "Foo 1", BAD_VALUE, MULT1, COUNT)
    with pytest.raises(ValueError):
        yparam.y_scale_str  # pylint: disable=pointless-statement
Пример #3
0
def netlist_plotInstructions(header: List[str], values):
    """
    Describe how to plot the information.
    tsp.do_plot() uses this.

    :param: header: List[str] holding 'Tick', 'Second', ...
    :param: values: 2d array of float [tick_i, valuetype_i]
    :return: x_label: str -- e.g. "Day", "Month", "Year"
    :return: x: List[float] -- x-axis info on how to plot
    :return: y_params: List[YParam] -- y-axis info on how to plot
    """
    x_label = "Year"
    x = arrayToFloatList(values[:, header.index(x_label)])

    y_params = [
        YParam(
            ["OCEAN_vested", "OCEAN_released", "beneficiary_OCEAN"],
            ["OCEAN vested", "OCEAN released", "OCEAN to beneficiary"],
            "Vesting over time",
            LINEAR,
            MULT1,
            DOLLAR,
        )
    ]

    return (x_label, x, y_params)
Пример #4
0
def netlist_plotInstructions(header: List[str], values):
    """
    Describe how to plot the information.
    tsp.do_plot() uses this.

    :param: header: List[str] holding 'Tick', 'Second', ...
    :param: values: 2d array of float [tick_i, valuetype_i]
    :return: x_label: str -- e.g. "Day", "Month", "Year"
    :return: x: List[float] -- x-axis info on how to plot
    :return: y_params: List[YParam] -- y-axis info on how to plot
    """
    x_label = "Day"
    x = arrayToFloatList(values[:, header.index(x_label)])

    y_params = [
        YParam(["granter_OCEAN"], ["OCEAN"], "granter_OCEAN", LINEAR, MULT1,
               DOLLAR),
        YParam(["granter_USD"], ["USD"], "granter_USD", LINEAR, MULT1, DOLLAR),
    ]

    return (x_label, x, y_params)
Пример #5
0
def test_yparam1():
    yparam = YParam(
        ["headername1", "headername2"],
        ["Header 1", "Header 2"],
        "Header 1 and 2",
        LINEAR,
        MULT1,
        COUNT,
    )

    assert yparam.y_header_names == ["headername1", "headername2"]
    assert yparam.labels == ["Header 1", "Header 2"]
    assert yparam.y_pretty_name == "Header 1 and 2"
    assert yparam.y_scale == LINEAR
    assert yparam.mult == MULT1
    assert yparam.unit == COUNT
    assert yparam.y_scale_str == "LINEAR"
Пример #6
0
def test_expandBOTHinY():
    yparams = [YParam(["foo1"], ["foo 1"], "Foo 1", BOTH, MULT1, COUNT)]
    yparams2 = _expandBOTHinY(yparams)
    assert len(yparams2) == 2
    assert sorted([yparams2[0].y_scale, yparams2[1].y_scale]) == sorted([LINEAR, LOG])
Пример #7
0
def netlist_plotInstructions(header: List[str], values):
    """
    Describe how to plot the information.
    tsp.do_plot() calls this
    :param: header: List[str] holding 'Tick', 'Second', ...
    :param: values: 2d array of float [tick_i, valuetype_i]
    :return: x_label: str -- e.g. "Day", "Month", "Year"
    :return: x: List[float] -- x-axis info on how to plot
    :return: y_params: List[YParam] -- y-axis info on how to plot
    """
    x_label = "Day"
    x = arrayToFloatList(values[:, header.index(x_label)])

    y_params = [
        YParam(
            [
                "publisher_OCEAN_networth",
                "consumer_OCEAN_networth",
                "stakerSpeculator_OCEAN_networth",
                "speculator_OCEAN_networth",
                # "buySellRobot_OCEAN_networth",
                # "maliciousPublisher_OCEAN_networth"
            ],
            [
                "publisher",
                "consumer",
                "stakerSpeculator",
                "speculator",
                # "buySellRobot",
                # "maliciousPublisher"
            ],
            "Agents OCEAN networth",
            LINEAR,
            MULT1,
            COUNT,
        ),
        YParam(
            [
                "publisher_OCEAN",
                "consumer_OCEAN",
                "stakerSpeculator_OCEAN",
                "speculator_OCEAN",
                # "buySellRobot_OCEAN",
                # "maliciousPublisher_OCEAN"
            ],
            [
                "publisher",
                "consumer",
                "staker",
                "speculator",
                # "buySellRobot",
                # "maliciousPublisher"
            ],
            "Agents OCEAN wallet",
            LINEAR,
            MULT1,
            DOLLAR,
        ),
        YParam(
            [
                "DT_publisher",
                "DT_consumer",
                "DT_stakerSpeculator",
                "DT_speculator",
                "DT_buySellRobot"
                # "DT_maliciousPublisher"
            ],
            [
                "publisher",
                "consumer",
                "staker",
                "speculator",
                "buySellRobot",
                # "maliciousPublisher"
            ],
            "Agents Datatokens",
            LINEAR,
            MULT1,
            DOLLAR,
        ),
        YParam(
            ["DT_pool", "DT_1ss_contract"],
            ["DT in pool", "DT in one-sided staking contract"],
            "DT allocation",
            LINEAR,
            MULT1,
            COUNT,
        ),
        YParam(
            [
                "BPT_publisher",
                "BPT_consumer",
                "BPT_stakerSpeculator",
                "BPT_speculator",
                # "BPT_maliciousPublisher",
                "BPT_1ss_contract",
            ],
            [
                "publisher",
                "consumer",
                "staker",
                "speculator",
                # "maliciousPublisher",
                "one-sided staking contract",
            ],
            "BPT allocation",
            LINEAR,
            MULT1,
            COUNT,
        ),
        YParam(
            ["DT_price"],
            [
                "DT_price",
            ],
            "dt price",
            LINEAR,
            MULT1,
            DOLLAR,
        ),
        YParam(["n_pools"], ["# pools"], "n_pools", LINEAR, MULT1, COUNT),
        YParam(["pool_OCEAN"], ["pool_OCEAN"], "pool_OCEAN", LINEAR, MULT1, DOLLAR),
    ]

    return (x_label, x, y_params)
Пример #8
0
def netlist_plotInstructions(header: List[str], values):
    """
    Describe how to plot the information.
    tsp.do_plot() calls this

    :param: header: List[str] holding 'Tick', 'Second', ...
    :param: values: 2d array of float [tick_i, valuetype_i]
    :return: x_label: str -- e.g. "Day", "Month", "Year"
    :return: x: List[float] -- x-axis info on how to plot
    :return: y_params: List[YParam] -- y-axis info on how to plot
    """
    x_label = "Year"
    x = arrayToFloatList(values[:, header.index(x_label)])

    y_params = [
        YParam(["OCEAN_price"], [""], "OCEAN Price", LOG, MULT1, DOLLAR),
        # YParam(["network_rev_growth/yr"], [""],
        #        "Annual Network Revenue Growth", BOTH, MULT100, PERCENT),
        YParam(
            [
                "overall_valuation", "fundamentals_valuation",
                "speculation_valuation"
            ],
            ["Overall", "Fundamentals (P/S=30)", "Speculation"],
            "Valuation",
            LOG,
            DIV1M,
            DOLLAR,
        ),
        YParam(
            ["dao_USD/mo", "dao_OCEAN_in_USD/mo", "dao_total_in_USD/mo"],
            [
                "Income as USD (ie network revenue)",
                "Income as OCEAN (ie from 51%; priced in USD)",
                "Total Income",
            ],
            "Monthly OceanDAO Income",
            LOG,
            DIV1M,
            DOLLAR,
        ),
        YParam(
            [
                "network_rev/yr", "allmkts_cons_sales/yr",
                "allmkts_tot_sales/yr"
            ],
            [
                "Network Revenue",
                "All marketplaces consume sales",
                "All marketplaces total sales",
            ],
            "Annual Revenue or Sales",
            LOG,
            DIV1M,
            DOLLAR,
        ),
        YParam(
            ["tot_staked"],
            ["USD worth of OCEAN"],
            "Total OCEAN Staked (in USD)",
            LOG,
            DIV1M,
            DOLLAR,
        ),
        YParam(
            ["tot_OCEAN_supply", "tot_OCEAN_minted", "tot_OCEAN_burned"],
            ["Total supply", "Tot # Minted", "Tot # Burned"],
            "OCEAN Token Count",
            BOTH,
            DIV1M,
            COUNT,
        ),
        YParam(
            ["OCEAN_minted/mo", "OCEAN_burned/mo"],
            ["# Minted/mo", "# Burned/mo"],
            "Monthly # OCEAN Minted & Burned",
            BOTH,
            DIV1M,
            COUNT,
        ),
        YParam(
            ["rnd_to_cons_sales_ratio", "mkts_annual_growth_rate"],
            ["R&D/consume_sales ratio", "Marketplaces annual growth rate"],
            "R&D/Sales Ratio and Marketplaces Growth Rate",
            BOTH,
            MULT100,
            PERCENT,
        ),
        YParam(["RND/mo"], [""], "Monthly R&D Spend", BOTH, DIV1M, DOLLAR),
        # YParam(["OCEAN_burned_USD/mo", "OCEAN_minted_USD/mo"],
        #       ["$ of OCEAN Burned/mo", "$ of OCEAN Minted/mo"],
        #       "Monthly OCEAN (in USD) Minted & Burned", LOG, DIV1M, DOLLAR),
        # YParam(["OCEAN_burned_USD/mo", "network_rev/mo", "allmkts_total_sales/mo"],
        #       ["$ OCEAN Burned monthly", "Ocean monthly revenue", "Marketplaces monthly sales"],
        #       "Monthly OCEAN Burned and Revenues", LOG, DIV1M, DOLLAR),
    ]

    return (x_label, x, y_params)