app.backbone.entities.ticker
1from sqlalchemy import Column, ForeignKey, Integer, Float, String 2from sqlalchemy.orm import relationship 3 4from . import Base 5 6# Clase que representa una tabla en la base de datos 7class Ticker(Base): 8 __tablename__ = 'Tickers' # Nombre de la tabla en la BD 9 10 Id = Column(Integer, primary_key=True, autoincrement=True) 11 CategoryId = Column(Integer, ForeignKey('Categories.Id')) # Referencia a la tabla Categories 12 Name = Column(String, nullable=False) 13 Spread = Column(Float, nullable=False) 14 15 Category = relationship('Category', back_populates='Tickers', lazy='joined') 16 Bot = relationship('Bot', back_populates='Ticker', lazy='select') 17 18 def __repr__(self): 19 return f"<Ticker(id={self.Id}, name='{self.Name}', spread={self.Spread})>"
class
Ticker(sqlalchemy.orm.decl_api._DynamicAttributesType, sqlalchemy.inspection.Inspectable[sqlalchemy.orm.mapper.Mapper[typing.Any]]):
8class Ticker(Base): 9 __tablename__ = 'Tickers' # Nombre de la tabla en la BD 10 11 Id = Column(Integer, primary_key=True, autoincrement=True) 12 CategoryId = Column(Integer, ForeignKey('Categories.Id')) # Referencia a la tabla Categories 13 Name = Column(String, nullable=False) 14 Spread = Column(Float, nullable=False) 15 16 Category = relationship('Category', back_populates='Tickers', lazy='joined') 17 Bot = relationship('Bot', back_populates='Ticker', lazy='select') 18 19 def __repr__(self): 20 return f"<Ticker(id={self.Id}, name='{self.Name}', spread={self.Spread})>"
The base class of the class hierarchy.
When called, it accepts no arguments and returns a new featureless instance that has no instance attributes and cannot be given any.
Ticker(**kwargs)
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and
values in kwargs.
Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.