fintual

package
v0.0.0-...-2ebd621 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package fintual provides utilties for interfacing with the Fintual API.

Index

Constants

View Source
const Version = "1.0.0"

Version is the version of this library.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetProvider

type AssetProvider struct {
	ID         string                  `json:"id"`
	Type       string                  `json:"type"`
	Attributes AssetProviderAttributes `json:"attributes"`
}

type AssetProviderAttributes

type AssetProviderAttributes struct {
	Name string `json:"name"`
}

type AssetProvidersService

type AssetProvidersService service

AssetProvidersService handles communication with the Asset Providers related methods of the Fintual API.

Fintual API docs: https://fintual.cl/api-docs

func (*AssetProvidersService) Get

Get retrieves a single asset provider.

Endpoint: GET /asset_providers/:id

func (*AssetProvidersService) ListAll

ListAll lists all asset providers.

Endpoint: GET /asset_providers

type Bank

type Bank struct {
	ID         string         `json:"id"`
	Type       string         `json:"type"`
	Attributes BankAttributes `json:"attributes"`
}

type BankAttributes

type BankAttributes struct {
	Name string `json:"name"`
}

type BankListParams

type BankListParams struct {
	Query string `url:"q,omitempty"` // For filtering results
}

BankListParams specifies the optional parameters to the BanksService.ListAll method.

type BanksService

type BanksService service

BanksService handles communication with the Banks related methods of the Fintual API.

Fintual API docs: https://fintual.cl/api-docs

func (*BanksService) ListAll

func (s *BanksService) ListAll(ctx context.Context, params *BankListParams) ([]*Bank, error)

ListAll lists all Banks. Receives a params argument with a Query property for filtering Banks by the Name attribute.

Endpoint: GET /banks

type Client

type Client struct {

	// Services used for talking to different parts of the Fintual API.
	AssetProviders   *AssetProvidersService
	Banks            *BanksService
	ConceptualAssets *ConceptualAssetsService
	Goals            *GoalsService
	RealAssets       *RealAssetsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Fintual API client. If a nil httpClient is provided, a new http.Client will be used.

To use API methods which require authentication, you must call the Client.Authenticate method with valid credentials.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, email, password string) error

Authenticate tries to retrieve a user access token from the Fintual access_tokens endpoint and sets it to the current Fintual client

type ConceptualAsset

type ConceptualAsset struct {
	ID         string                    `json:"id"`
	Type       string                    `json:"type"`
	Attributes ConceptualAssetAttributes `json:"attributes"`
}

type ConceptualAssetAttributes

type ConceptualAssetAttributes struct {
	Name       string `json:"name"`
	Symbol     string `json:"symbol"`
	Category   string `json:"category"`
	Currency   string `json:"currency"`
	MaxScale   int    `json:"max_scale"`
	Run        string `json:"run"`
	DataSource string `json:"data_source"`
}

type ConceptualAssetListParams

type ConceptualAssetListParams struct {
	Name string `url:"name,omitempty"` // For filtering results by name
	Run  string `url:"run,omitempty"`  // For filtering results by run identifier
}

ConceptualAssetListParams specifies the optional parameters to the ListConceptualAssets method.

type ConceptualAssetRealAsset

type ConceptualAssetRealAsset struct {
	ID         string                             `json:"id"`
	Type       string                             `json:"type"`
	Attributes ConceptualAssetRealAssetAttributes `json:"attributes"`
}

type ConceptualAssetRealAssetAttributes

type ConceptualAssetRealAssetAttributes struct {
	Name              string                          `json:"name"`
	Symbol            string                          `json:"symbol"`
	Serie             string                          `json:"serie"`
	StartDate         string                          `json:"start_date"`
	EndDate           string                          `json:"end_date"`
	PreviousAssetID   string                          `json:"previous_asset_id"`
	LastDay           ConceptualAssetRealAssetLastDay `json:"last_day"`
	ConceptualAssetID int                             `json:"conceptual_asset_id"`
}

type ConceptualAssetRealAssetLastDay

type ConceptualAssetRealAssetLastDay struct {
	Rate float64 `json:"rate"`
	Date string  `json:"date"`
}

type ConceptualAssetsService

type ConceptualAssetsService service

ConceptualAssetsService handles communication with the Conceptual Assets related methods of the Fintual API.

Fintual API docs: https://fintual.cl/api-docs

func (*ConceptualAssetsService) Get

Get retrieves a single Conceptual Asset.

Endpoint: GET /conceptual_assets/:id

func (*ConceptualAssetsService) ListAll

ListAll lists all conceptual assets. Receives a params argument with Name and/or Run properties for filtering Conceptual Assets by the Name and Run attributes.

Endpoint: GET /conceptual_assets

func (*ConceptualAssetsService) ListByAssetProvider

func (s *ConceptualAssetsService) ListByAssetProvider(ctx context.Context, id string, params *ConceptualAssetListParams) ([]*ConceptualAsset, error)

ListByAssetProvider lists all Conceptual Assets of a given Asset Provider. Receives a params argument with Name and/or Run properties for filtering Conceptual Assets by the Name and Run attributes.

Endpoint: GET /asset_providers/:id/conceptual_assets

type Credentials

type Credentials struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Error

type Error struct {
	Code    int    `json:"code"`    // The HTTP status code.
	Status  string `json:"status"`  // The HTTP response status (error or success).
	Message string `json:"message"` // A short description of the error.
}

Error represents an error returned by the Fintual API.

type ExpenseRationRealAsset

type ExpenseRationRealAsset struct {
	ID         string                           `json:"id"`
	Type       string                           `json:"type"`
	Attributes ExpenseRationRealAssetAttributes `json:"attributes"`
}

type ExpenseRationRealAssetAttributes

type ExpenseRationRealAssetAttributes struct {
	ExpenseRatio float64 `json:"expense_ratio"`
}

type Goal

type Goal struct {
	ID         string         `json:"id"`
	Type       string         `json:"type"`
	Attributes GoalAttributes `json:"attributes"`
}

type GoalAttributes

type GoalAttributes struct {
	Name                   string       `json:"name"`
	NameWithoutSuffix      string       `json:"name_without_suffix"`
	NetAssetValue          float64      `json:"nav"`
	CreatedAt              string       `json:"created_at"`
	Timeframe              int          `json:"timeframe"`
	Deposited              float64      `json:"deposited"`
	Hidden                 bool         `json:"hidden"`
	Profit                 float64      `json:"profit"`
	Investments            []Investment `json:"investments"`
	PublicLink             interface{}  `json:"public_link"`
	ParamID                int64        `json:"param_id"`
	GoalType               string       `json:"goal_type"`
	TranslatedGoalType     string       `json:"translated_goal_type"`
	Regime                 interface{}  `json:"regime"`
	Completed              bool         `json:"completed"`
	HasAnyWithdrawals      bool         `json:"has_any_withdrawals"`
	EligibleForDeposits    bool         `json:"eligible_for_deposits"`
	EligibleForInternalMlt bool         `json:"eligible_for_internal_mlt"`
	MonthlyDeposit         float64      `json:"monthly_deposit"`
	SimulatedDeposit       float64      `json:"simulated_deposit"`
	FundsSource            interface{}  `json:"funds_source"`
	FundsSourceDescription interface{}  `json:"funds_source_description"`
	NotNetDeposited        float64      `json:"not_net_deposited"`
	Withdrawn              float64      `json:"withdrawn"`
	GroupGoalID            interface{}  `json:"group_goal_id"`
}

type GoalsService

type GoalsService service

GoalsService handles communication with the Goals related methods of the Fintual API.

Fintual API docs: https://fintual.cl/api-docs

func (*GoalsService) Get

func (s *GoalsService) Get(ctx context.Context, id string) (*Goal, error)

Get retrieves a specific goal. Requires authentication by calling Client.Authenticate.

Endpoint: GET /goals/:id

func (*GoalsService) ListAll

func (s *GoalsService) ListAll(ctx context.Context) ([]*Goal, error)

ListAll lists all Goals for the authenticated user. Requires authentication by calling Client.Authenticate.

Endpoint: GET /goals

type Investment

type Investment struct {
	Weight  float64 `json:"weight"`
	AssetID int     `json:"asset_id"`
}

type LastDay

type LastDay struct {
	FixedManagementFee     float64 `json:"fixed_management_fee"`
	IvaExclusiveExpenses   float64 `json:"iva_exclusive_expenses"`
	IvaInclusiveExpenses   float64 `json:"iva_inclusive_expenses"`
	NetAssetValue          float64 `json:"net_asset_value"`
	PurchaseFee            float64 `json:"purchase_fee"`
	RedemptionFee          float64 `json:"redemption_fee"`
	TotalAssets            float64 `json:"total_assets"`
	TotalNetAssets         float64 `json:"total_net_assets"`
	VariableManagementFee  float64 `json:"variable_management_fee"`
	FixedFee               float64 `json:"fixed_fee"`
	NewShares              float64 `json:"new_shares"`
	OutstandingShares      float64 `json:"outstanding_shares"`
	RedeemedShares         float64 `json:"redeemed_shares"`
	InstitutionalInvestors float64 `json:"institutional_investors"`
	Shareholders           float64 `json:"shareholders"`
	Date                   string  `json:"date"`
}

type RealAsset

type RealAsset struct {
	ID         string              `json:"id"`
	Type       string              `json:"type"`
	Attributes RealAssetAttributes `json:"attributes"`
}

type RealAssetAttributes

type RealAssetAttributes struct {
	Name              string      `json:"name"`
	Symbol            string      `json:"symbol"`
	Serie             string      `json:"serie"`
	StartDate         string      `json:"start_date"`
	EndDate           interface{} `json:"end_date"`
	PreviousAssetID   interface{} `json:"previous_asset_id"`
	LastDay           LastDay     `json:"last_day"`
	ConceptualAssetID int         `json:"conceptual_asset_id"`
}

type RealAssetDay

type RealAssetDay struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Attributes RealAssetDayAttributes `json:"attributes"`
}

type RealAssetDayAttributes

type RealAssetDayAttributes struct {
	Date                       string  `json:"date"`
	Price                      float64 `json:"price"`
	FixedManagementFee         float64 `json:"fixed_management_fee"`
	FixedManagementFeeType     string  `json:"fixed_management_fee_type"`
	IvaExclusiveExpenses       float64 `json:"iva_exclusive_expenses"`
	IvaExclusiveExpensesType   string  `json:"iva_exclusive_expenses_type"`
	IvaInclusiveExpenses       float64 `json:"iva_inclusive_expenses"`
	IvaInclusiveExpensesType   string  `json:"iva_inclusive_expenses_type"`
	NetAssetValue              float64 `json:"net_asset_value"`
	NetAssetValueType          string  `json:"net_asset_value_type"`
	PurchaseFee                float64 `json:"purchase_fee"`
	PurchaseFeeType            string  `json:"purchase_fee_type"`
	RedemptionFee              float64 `json:"redemption_fee"`
	RedemptionFeeType          string  `json:"redemption_fee_type"`
	TotalAssets                float64 `json:"total_assets"`
	TotalAssetsType            string  `json:"total_assets_type"`
	TotalNetAssets             float64 `json:"total_net_assets"`
	TotalNetAssetsType         string  `json:"total_net_assets_type"`
	VariableManagementFee      float64 `json:"variable_management_fee"`
	VariableManagementFeeType  string  `json:"variable_management_fee_type"`
	FixedFee                   float64 `json:"fixed_fee"`
	FixedFeeType               string  `json:"fixed_fee_type"`
	NewShares                  float64 `json:"new_shares"`
	NewSharesType              string  `json:"new_shares_type"`
	OutstandingShares          float64 `json:"outstanding_shares"`
	OutstandingSharesType      string  `json:"outstanding_shares_type"`
	RedeemedShares             float64 `json:"redeemed_shares"`
	RedeemedSharesType         string  `json:"redeemed_shares_type"`
	InstitutionalInvestors     float64 `json:"institutional_investors"`
	InstitutionalInvestorsType string  `json:"institutional_investors_type"`
	Shareholders               float64 `json:"shareholders"`
	ShareholdersType           string  `json:"shareholders_type"`
}

type RealAssetsService

type RealAssetsService service

RealAssetsService handles communication with the Real Assets related methods of the Fintual API.

Fintual API docs: https://fintual.cl/api-docs

func (*RealAssetsService) Get

func (s *RealAssetsService) Get(ctx context.Context, id string) (*RealAsset, error)

Get retrieves a single Real Asset.

Endpoint: GET /real_assets/:id

func (*RealAssetsService) GetDay

func (s *RealAssetsService) GetDay(ctx context.Context, id string, date string) ([]*RealAssetDay, error)

GetDay retrieves a Real Asset Day. Receives a Real Asset ID and a string date with format YYYY-MM-DD.

Endpoint: GET /real_assets/:id/days

func (*RealAssetsService) GetExpenseRatio

func (s *RealAssetsService) GetExpenseRatio(ctx context.Context, id string) (*ExpenseRationRealAsset, error)

GetExpenseRatio retrieves the Expense Ratio for a single Real Asset.

Endpoint: GET /real_assets/:id/expense_ratio

func (*RealAssetsService) ListByConceptualAsset

func (s *RealAssetsService) ListByConceptualAsset(ctx context.Context, id string) ([]*ConceptualAssetRealAsset, error)

ListByConceptualAsset lists all Real Assets of a given Conceptual Asset.

Endpoint: GET /conceptual_assets/:id/real_assets

func (*RealAssetsService) ListDaysByDates

func (s *RealAssetsService) ListDaysByDates(ctx context.Context, id, from, to string) ([]*RealAssetDay, error)

ListDaysByDates lists Real Asset Days. Receives a Real Asset ID and a from and to string dates with format YYYY-MM-DD.

Endpoint: GET /real_assets/:id/days

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL