How to use the numerapi.utils.parse_float_string function in numerapi

To help you get started, we’ve selected a few numerapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uuazed / numerapi / tests / test_utils.py View on Github external
def test_parse_float_string():
    assert utils.parse_float_string(None) is None
    assert utils.parse_float_string("") is None
    assert utils.parse_float_string("1.23") == decimal.Decimal("1.23")
    assert utils.parse_float_string("12") == decimal.Decimal("12.0")
    assert utils.parse_float_string("1,000.0") == decimal.Decimal("1000.0")
    assert utils.parse_float_string("0.4") == decimal.Decimal("0.4")
github uuazed / numerapi / tests / test_utils.py View on Github external
def test_parse_float_string():
    assert utils.parse_float_string(None) is None
    assert utils.parse_float_string("") is None
    assert utils.parse_float_string("1.23") == decimal.Decimal("1.23")
    assert utils.parse_float_string("12") == decimal.Decimal("12.0")
    assert utils.parse_float_string("1,000.0") == decimal.Decimal("1000.0")
    assert utils.parse_float_string("0.4") == decimal.Decimal("0.4")
github uuazed / numerapi / tests / test_utils.py View on Github external
def test_parse_float_string():
    assert utils.parse_float_string(None) is None
    assert utils.parse_float_string("") is None
    assert utils.parse_float_string("1.23") == decimal.Decimal("1.23")
    assert utils.parse_float_string("12") == decimal.Decimal("12.0")
    assert utils.parse_float_string("1,000.0") == decimal.Decimal("1000.0")
    assert utils.parse_float_string("0.4") == decimal.Decimal("0.4")
github uuazed / numerapi / tests / test_utils.py View on Github external
def test_parse_float_string():
    assert utils.parse_float_string(None) is None
    assert utils.parse_float_string("") is None
    assert utils.parse_float_string("1.23") == decimal.Decimal("1.23")
    assert utils.parse_float_string("12") == decimal.Decimal("12.0")
    assert utils.parse_float_string("1,000.0") == decimal.Decimal("1000.0")
    assert utils.parse_float_string("0.4") == decimal.Decimal("0.4")
github uuazed / numerapi / tests / test_utils.py View on Github external
def test_parse_float_string():
    assert utils.parse_float_string(None) is None
    assert utils.parse_float_string("") is None
    assert utils.parse_float_string("1.23") == decimal.Decimal("1.23")
    assert utils.parse_float_string("12") == decimal.Decimal("12.0")
    assert utils.parse_float_string("1,000.0") == decimal.Decimal("1000.0")
    assert utils.parse_float_string("0.4") == decimal.Decimal("0.4")
github uuazed / numerapi / tests / test_utils.py View on Github external
def test_parse_float_string():
    assert utils.parse_float_string(None) is None
    assert utils.parse_float_string("") is None
    assert utils.parse_float_string("1.23") == decimal.Decimal("1.23")
    assert utils.parse_float_string("12") == decimal.Decimal("12.0")
    assert utils.parse_float_string("1,000.0") == decimal.Decimal("1000.0")
    assert utils.parse_float_string("0.4") == decimal.Decimal("0.4")
github uuazed / numerapi / numerapi / numerapi.py View on Github external
participants
                prizePoolNmr
                prizePoolUsd
                ruleset
              }
            }
        '''
        arguments = {'tournament': tournament}
        result = self.raw_query(query, arguments)
        rounds = result['data']['rounds']
        # convert datetime strings to datetime.datetime objects
        for r in rounds:
            utils.replace(r, "openTime", utils.parse_datetime_string)
            utils.replace(r, "resolveTime", utils.parse_datetime_string)
            utils.replace(r, "prizePoolNmr", utils.parse_float_string)
            utils.replace(r, "prizePoolUsd", utils.parse_float_string)
        return rounds
github uuazed / numerapi / numerapi / numerapi.py View on Github external
resolvedGeneral
                  resolvedStaking
                }
              }
            }
          }
        """
        data = self.raw_query(query, authorization=True)['data']
        payments = data['user']
        # convert strings to python objects
        for p in payments['payments']:
            utils.replace(p['round'], "openTime", utils.parse_datetime_string)
            utils.replace(p['round'], "resolveTime",
                          utils.parse_datetime_string)
            utils.replace(p, "usdAmount", utils.parse_float_string)
            utils.replace(p, "nmrAmount", utils.parse_float_string)
        for p in payments['reputationPayments']:
            utils.replace(p, "nmrAmount", utils.parse_float_string)
            utils.replace(p, "insertedAt", utils.parse_datetime_string)
        for p in payments['otherUsdIssuances']:
            utils.replace(p, "usdAmount", utils.parse_float_string)
            utils.replace(p, "insertedAt", utils.parse_datetime_string)
        return payments