Add view to access to OHLC solds for an account.
This commit is contained in:
parent
66a635669a
commit
f144c8ffc1
@ -143,9 +143,28 @@ class CategoriesResource(Resource):
|
||||
def get(self, session):
|
||||
kwargs = range_parser.parse_args()
|
||||
|
||||
return Operation.get_categories_for_range(session, **kwargs)
|
||||
return Operation.get_categories_for_range(session, **kwargs).all()
|
||||
|
||||
|
||||
ohlc_resource_fields = {
|
||||
'operation_date': fields.DateTime(dt_format='iso8601'),
|
||||
'open': fields.Float,
|
||||
'high': fields.Float,
|
||||
'low': fields.Float,
|
||||
'close': fields.Float
|
||||
}
|
||||
|
||||
|
||||
class SoldsResource(Resource):
|
||||
@session_aware
|
||||
@marshal_with_field(fields.List(Object(ohlc_resource_fields)))
|
||||
def get(self, session):
|
||||
kwargs = range_parser.parse_args()
|
||||
|
||||
return Operation.get_ohlc_per_day_for_range(session, **kwargs).all()
|
||||
|
||||
|
||||
api_api.add_resource(EntryListResource, "/entries")
|
||||
api_api.add_resource(EntryResource, "/entries/<int:entry_id>")
|
||||
api_api.add_resource(CategoriesResource, "/categories")
|
||||
api_api.add_resource(SoldsResource, "/solds")
|
||||
|
Loading…
Reference in New Issue
Block a user