GraphQL¶
Trading¶
GraphQL definitions for the Trading App
-
class
trading.graphql.AddTrade(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationAddTrade creates a new Trade for the user and stock
-
class
trading.graphql.GInvestmentBucketTrade(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeExposing the whole Trade object to GraphQL
-
class
trading.graphql.GTrade(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeExposing the whole Trade object to GraphQL
-
class
trading.graphql.GTradingAccount(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeExposing the whole TradingAccount to GraphQL
Authentication¶
GraphQL definitions for the Authentication App
-
class
authentication.graphql.AddTradingAccount(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationAddTradingAccount creates a new
trading.models.TradingAccountfor the user.-
class
Arguments[source]¶ Bases:
objectArguments to create a
trading.models.TradingAccount. Right now we only need the name.
-
static
mutate(_self, info, name, **_args)[source]¶ Creates a new
trading.models.TradingAccountfor the user and returns it.Parameters: - info – Information about the request / user.
- name (str) – Name of the new trading account.
-
class
-
class
authentication.graphql.GProfile(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeThis is the GraphQL representation of a
authentication.models.Profile. This is more of a publically accessible object. Even though we won’t expose everything, this object allows us to add more fields to the user object.-
static
resolve_invest_suggestions(_data, info, **_args)[source]¶ Returns a list of buckets that the User can invest in. (see
stocks.models.InvestmentBucket.available_buckets())Parameters: info (Graphene Request Info.) – Information about the user to check which recommendations are best for the user. Returns: django.db.models.query.QuerySetofstocks.models.InvestmentBucket
-
static
resolve_selected_acc(data, _info, **_args)[source]¶ Returns the current account the user has selected. Right now it just calls the default account of the profile. (see
authentication.models.Profile.default_acc())Returns: django.db.models.query.QuerySetoftrading.models.TradingAccount
-
static
resolve_stock_find(_self, _info, text, first=None, **_args)[source]¶ Finds a stock given a case insensitive name. (see
stocks.models.Stock.find_stock())Parameters: - text – The text the user want to search for.
- first – The maximum number of results to return
Returns: django.db.models.query.QuerySetofstocks.stocks.Stock
-
static
-
class
authentication.graphql.GUser(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeThis is the GraphQL representation of a
django.contrib.auth.models.User. This should only be accessible for the user himself.
-
class
authentication.graphql.GUserBank(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeGraphQL wrapper around the
authentication.models.UserBankmodel. This should only be accessible to the user.-
static
resolve_balance(data, _info, **_args)[source]¶ Calls
authentication.models.UserBank.current_balance()on data.Parameters: data ( authentication.models.UserBank) – The Userbank we want to extract the balance from.Returns: The current balance of that the user has.
-
static
resolve_history(data, _info, start, **_args)[source]¶ This method returns the account history for a user. This is, how much value the bank account historically had. (see
authentication.models.UserBank.historical_data())Parameters: - data (
authentication.models.UserBank) – The bank we want to extract the history from. - start (str (YYYY-MM-dd)) – The date with that the history should start. The query will return the history from start until today.
Returns: stocks.graphql.DataPoint representing the history.
- data (
-
static
resolve_income(data, _info, **_args)[source]¶ Calls
authentication.models.UserBank.income()on data.Parameters: data ( authentication.models.UserBank) – The Userbank we want to extract the income from.Returns: The monthly income of the account.
-
static
resolve_monthly_end(_data, _info)[source]¶ End date for measuring the monthly income/expenditure
-
static
resolve_monthly_start(_data, _info)[source]¶ Start date for measuring the monthly income/expenditure
-
static
resolve_name(data, _info, **_args)[source]¶ Calls
authentication.models.UserBank.account_name()on data.Parameters: data ( authentication.models.UserBank) – The Userbank we want to get the account name.Returns: The account name of the bank.
-
static
resolve_outcome(data, _info, **_args)[source]¶ Calls
authentication.models.UserBank.expenditure()on data.Parameters: data ( authentication.models.UserBank) – The Userbank we want to extract the expenditures from.Returns: The monthly expenditure of the account.
-
static
Stocks¶
GraphQL definitions for the Stocks App
-
class
stocks.graphql.AddAttributeToInvestment(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationAdds a description to an Investment Bucket and returns the bucket
-
class
stocks.graphql.AddBucket(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationCreates a new InvestmentBucket and returns the new bucket
-
class
stocks.graphql.AddStock(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationAddStock creates a new Stock that is tracked
-
class
stocks.graphql.Config(id, quantity)¶ Bases:
tuple-
id¶ Alias for field number 0
-
quantity¶ Alias for field number 1
-
-
class
stocks.graphql.DataPoint(date, value)[source]¶ Bases:
objectDummy class to represent a date / value DataPoint
-
class
stocks.graphql.DeleteAttribute(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationDeletes an attribute from a bucket
-
class
stocks.graphql.DeleteBucket(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationDeletes an attribute from a bucket
-
class
stocks.graphql.EditAttribute(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationAllows to edit an attribute description
-
class
stocks.graphql.EditConfiguration(*args, **kwargs)[source]¶ Bases:
graphene.types.mutation.MutationMutation to change the stock configuration of a bucket
-
class
stocks.graphql.GDailyStockQuote(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeGraphQL representation of a DailyStockQuote
-
class
stocks.graphql.GDataPoint(*args, **kwargs)[source]¶ Bases:
graphene.types.objecttype.ObjectTypeGraphQL definition of the DataPoint above
-
class
stocks.graphql.GInvestmentBucket(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeGraphQL representation of a InvestmentBucket
-
static
resolve_history(data, _info, count=None, skip=None, **_args)[source]¶ Returns the historic data for the bucket
-
static
resolve_is_owner(data, info, **_args)[source]¶ Returns whether the user ownes the investment bucket
-
static
-
class
stocks.graphql.GInvestmentBucketAttribute(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeGraphQL representation of a InvestmentBucketDescription
-
class
stocks.graphql.GInvestmentBucketConfigurationUpdate(*args, **kwargs)[source]¶ Bases:
graphene.types.inputobjecttype.InputObjectTypeRepresents one choice of stock for a bucket
-
class
stocks.graphql.GInvestmentStockConfiguration(*args, **kwargs)[source]¶ Bases:
graphene_django.types.DjangoObjectTypeGraphQL representation of a InvestmentStockConfiguration