Fetch a list of portfolio positions from a brokerage account?

53 Views Asked by At

Use case which we want to built is a user will be presented with a list of financial institutions and when he selects anyone of it he needs to provide credentials to authenticate for selected institutions. Then brokerage account will be shown, clicking on it results into fetching of all portfolio positions.

So far what we have achieved:

  1. Fetching list of all institutions, this we can achieve using

API method: getInstitutions

  1. Selects an institution and authentication is performed (I am not sure this is the correct way of doing, if there is another way to do it then please let me know)

API method: discoverAndAddAccounts

  1. Get all accounts associated with it and using Brokerage account id fetch all positions:

API method: getInvestmentPositions

Using above will return all positions but we can not differentiate between 'buy' and 'sell' action of a position.

Note: We are using this gem for the same: https://github.com/cloocher/aggcat

Thanks in advance.

1

There are 1 best solutions below

0
dan-klasson On

First you have to know the definition of an option:

DEFINITION of 'Option'

A financial derivative that represents a contract sold by one party (option writer) to another party (option holder). The contract offers the buyer the right, but not the obligation, to buy (call) or sell (put) a security or other financial asset at an agreed-upon price (the strike price) during a certain period of time or on a specific date (exercise date).

Then by looking at the Intuit documenation we can see that:

positionType string

This is used to explain how long a position is held and differentiate between writers and holders of an option or other security.

E.g. SHORT = Writer for options, Short - Write for all other securities, LONG = Holder for options, Long = Holder for all other securities. For Bonds, it is always "LONG".