How to use the schematics.types.FloatType function in schematics

To help you get started, we’ve selected a few schematics 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 hellobiek / smart_deal_tool / crawler / dspider / validators.py View on Github external
date = StringType(required=True)
    unit = StringType(required=True)
    new_investor = FloatType(required=True)
    new_natural_person = FloatType(required=True)
    new_non_natural_person = FloatType(required=True)
    final_investor = FloatType(required=True)
    final_natural_person = FloatType(required=True)
    final_natural_a_person = FloatType(required=True)
    final_natural_b_person = FloatType(required=True)
    final_non_natural_person = FloatType(required=True)
    final_non_natural_a_person = FloatType(required=True)
    final_non_natural_b_person = FloatType(required=True)
    final_hold_investor = FloatType(required=True)
    final_a_hold_investor = FloatType(required=True)
    final_b_hold_investor = FloatType(required=True)
    trading_investor = FloatType(required=True)
    trading_a_investor = FloatType(required=True)
    trading_b_investor = FloatType(required=True)

class PlateValuationModel(Model):
    date = StringType(required=True)
    code = StringType(required=True)
    name = StringType(required=True)
    pe = FloatType(required=True)
    ttm = FloatType(required=True)
    pb = FloatType(required=True)
    dividend = FloatType(required=True)

class ChinaTreasuryRateModel(Model):
    date = StringType(required=True)
    name = StringType(required=True)
    month3 = FloatType(required=True)
github jmcarp / betfair.py / betfair / models.py View on Github external
market_name = StringType()
    market_type = StringType()
    placed_date = DateTimeType()
    selection_id = LongType()
    selection_name = StringType()
    start_date = DateTimeType()
    transaction_type = StringType()
    transaction_id = LongType()
    win_lose = StringType()


class StatementItem(BetfairModel):
    ref_id = StringType()
    item_date = DateTimeType()
    amount = FloatType()
    balance = FloatType()
    item_class = EnumType(constants.ItemClass)
    item_class_data = DictType(StringType)
    legacy_data = ModelType(StatementLegacyData)


class AccountDetailsResponse(BetfairModel):
    currency_code = StringType()
    first_name = StringType()
    last_name = StringType()
    locale_code = StringType()
    region = StringType()
    timezone = StringType()
    discount_rate = FloatType()
    points_balance = IntType()
    country_code = StringType()
github jmcarp / betfair.py / betfair / models.py View on Github external
class BaseInstructionReport(BetfairModel):
    status = EnumType(constants.InstructionReportStatus, required=True)
    error_code = EnumType(constants.InstructionReportErrorCode)


class PlaceInstructionReport(BaseInstructionReport):
    instruction = ModelType(PlaceInstruction, required=True)
    bet_id = StringType()
    placed_date = DateTimeType()
    average_price_matched = FloatType()
    size_matched = FloatType()


class CancelInstructionReport(BaseInstructionReport):
    instruction = ModelType(CancelInstruction)
    size_cancelled = FloatType(required=True)
    cancelled_date = DateTimeType()


class ReplaceInstructionReport(BaseInstructionReport):
    cancel_instruction_report = ModelType(CancelInstructionReport)
    place_instruction_report = ModelType(PlaceInstructionReport)


class UpdateInstructionReport(BaseInstructionReport):
    instruction = ModelType(UpdateInstruction, required=True)


# Execution reports

class BaseExecutionReport(BetfairModel):
    customer_ref = StringType()
github hellobiek / smart_deal_tool / crawler / dspider / validators.py View on Github external
new_non_natural_person = FloatType(required=True)
    final_natural_person = FloatType(required=True)
    final_non_natural_person = FloatType(required=True)
    unit = StringType(required=True)

class HkexTradeOverviewModel(Model):
    market = StringType(required=True)
    direction = StringType(required=True)
    date = StringType(required=True)
    total_turnover = FloatType(required=True)
    buy_turnover = FloatType(required=True)
    sell_turnover = FloatType(required=True)
    total_trade_count = IntType(required=True)
    buy_trade_count = IntType(required=True)
    sell_trade_count = IntType(required=True)
    dqb = FloatType(required=True)
    dqb_ratio = FloatType(required=True)

class HkexTradeTopTenModel(Model):
    market = StringType(required=True)
    direction = StringType(required=True)
    date = StringType(required=True)
    rank = IntType(required=True)
    code = StringType(required=True)
    name = StringType(required=True)
    buy_turnover = FloatType(required=True)
    sell_turnover = FloatType(required=True)
    total_turnover = FloatType(required=True)

class StockLimitModel(Model):
    fcb = FloatType(required=True)
    flb = FloatType(required=True)
github hellobiek / smart_deal_tool / crawler / dspider / validators.py View on Github external
sell_turnover = FloatType(required=True)
    total_trade_count = IntType(required=True)
    buy_trade_count = IntType(required=True)
    sell_trade_count = IntType(required=True)
    dqb = FloatType(required=True)
    dqb_ratio = FloatType(required=True)

class HkexTradeTopTenModel(Model):
    market = StringType(required=True)
    direction = StringType(required=True)
    date = StringType(required=True)
    rank = IntType(required=True)
    code = StringType(required=True)
    name = StringType(required=True)
    buy_turnover = FloatType(required=True)
    sell_turnover = FloatType(required=True)
    total_turnover = FloatType(required=True)

class StockLimitModel(Model):
    fcb = FloatType(required=True)
    flb = FloatType(required=True)
    date = StringType(required=True)
    code = StringType(required=True)
    price = FloatType(required=True)
    pchange = FloatType(required=True)
    prange = FloatType(required=True)
    intensity = FloatType(required=True)
    fdmoney = FloatType(required=True)
    open_times = IntType(required=True)
    first_time = StringType(required=True)
    last_time = StringType(required=True)
    concept = StringType()
github predicthq / sdk-py / predicthq / endpoints / schemas.py View on Github external
analysis_to = DateTimeType()
    analysis_tz = StringType(choices=pytz.all_timezones)
    significance = FloatType(min_value=0, max_value=100)
    metric = StringType(choices=('demand', 'lead', 'span'))
    explain = DateType()


class DateAround(Model):

    class Options:
        serialize_when_none = False

    origin = DateType(required=True)
    offset = StringType(regex='\d+d')
    scale = StringType(regex='\d+d')
    decay = FloatType()


class LocationAround(Model):

    class Options:
        serialize_when_none = False

    origin = StringType(regex='(-?\d+(\.\d+)?),(-?\d+(\.\d+)?)', required=True)
    offset = StringType(regex='\d+(\.\d+)?(cm|m|km|in|ft|mi)')
    scale = StringType(regex='\d+(\.\d+)?(cm|m|km|in|ft|mi)')
    decay = FloatType()


class DateTimeRange(Model):

    class Options:
github jmcarp / betfair.py / betfair / models.py View on Github external
item_date = DateTimeType()
    amount = FloatType()
    balance = FloatType()
    item_class = EnumType(constants.ItemClass)
    item_class_data = DictType(StringType)
    legacy_data = ModelType(StatementLegacyData)


class AccountDetailsResponse(BetfairModel):
    currency_code = StringType()
    first_name = StringType()
    last_name = StringType()
    locale_code = StringType()
    region = StringType()
    timezone = StringType()
    discount_rate = FloatType()
    points_balance = IntType()
    country_code = StringType()


class AccountStatementReport(BetfairModel):
    account_statement = ListType(ModelType(StatementItem))
    more_available = BooleanType()


class CurrencyRate(BetfairModel):
    currency_code = StringType()
    rate = FloatType()


class TransferResponse(BetfairModel):
    transaction_id = StringType()
github jmcarp / betfair.py / betfair / models.py View on Github external
in_play_only = BooleanType()
    market_betting_types = ListType(EnumType(constants.MarketBettingType))
    market_countries = ListType(StringType)
    market_type_codes = ListType(StringType)
    market_start_time = ModelType(TimeRange)
    with_orders = ListType(EnumType(constants.OrderStatus))


class PriceSize(BetfairModel):
    price = FloatType(required=True)
    size = FloatType(required=True)


class StartingPrices(BetfairModel):
    near_price = FloatType()
    far_price = FloatType()
    back_stake_taken = ListType(ModelType(PriceSize))
    lay_liability_taken = ListType(ModelType(PriceSize))
    actual_SP = FloatType()


class ExchangePrices(BetfairModel):
    available_to_back = ListType(ModelType(PriceSize))
    available_to_lay = ListType(ModelType(PriceSize))
    traded_volume = ListType(ModelType(PriceSize))


class Order(BetfairModel):
    bet_id = StringType(required=True)
    order_type = EnumType(constants.OrderType, required=True)
    status = EnumType(constants.OrderStatus, required=True)
    persistence_type = EnumType(constants.PersistenceType, required=True)
github WeijuNB / PyF5 / pyf5 / models.py View on Github external
EVENT_TYPE_MOVED,
        EVENT_TYPE_DELETED,
        EVENT_TYPE_CREATED,
        EVENT_TYPE_MODIFIED
    ])


class Project(BaseModel):
    path = StringType(required=True)
    active = BooleanType(default=False)
    muteList = ListType(StringType(), default=[])
    targetHost = StringType()
    QRhost = StringType(default='127.0.0.1')
    compileLess = BooleanType(default=False)
    compileCoffee = BooleanType(default=False)
    delay = FloatType(default=0.0)


class Config(BaseModel):
    projects = ListType(ModelType(Project), default=[])

    @classmethod
    def load(cls, path):
        config_data = cPickle.load(open(path))
        config = Config(config_data)
        return config

    def save(self, path):
        cPickle.dump(self.dict(), open(path, 'w+'))
        return True
github pylipp / financeager / financeager / period.py View on Github external
from tinydb.database import Element
from schematics.models import Model as SchematicsModel
from schematics.types import StringType, FloatType, DateType
from schematics.exceptions import DataError, ValidationError

from . import PERIOD_DATE_FORMAT, default_period_name, DEFAULT_TABLE

# format for ValidationModel.to_primitive() call
DateType.SERIALIZED_FORMAT = PERIOD_DATE_FORMAT

_DEFAULT_CATEGORY = None


class BaseValidationModel(SchematicsModel):
    name = StringType(min_length=1, required=True)
    value = FloatType(required=True)
    category = StringType(min_length=1)


class StandardEntryValidationModel(BaseValidationModel):
    date = DateType(formats=("%Y-%m-%d", PERIOD_DATE_FORMAT))


class RecurrentEntryValidationModel(BaseValidationModel):
    frequency = StringType(
        choices=[
            "yearly", "half-yearly", "quarter-yearly", "bimonthly", "monthly",
            "weekly", "daily"
        ],
        required=True)
    start = DateType(formats=("%Y-%m-%d", PERIOD_DATE_FORMAT))
    end = DateType(formats=("%Y-%m-%d", PERIOD_DATE_FORMAT))