Documentation

Get a user's cost basis

Get cost basis information for each of a user's accounts. The cost basis information is identical to a request made against the accounts/gainloss call. This call should be used when information is required across multiple accounts, as opposed to making multiple account-based calls.

Endpoint

Method
GET
URL
/v1/user/gainloss

Headers

Accept
application/xml, application/json, application/javascript
Default: application/xml
Required: false
Authorization
Bearer {access token}
Required: true

Response

Field Description
close_date Date the position was closed.
cost Total cost of the order.
gain_loss Gain or loss on the position.
gain_loss_percent Percentage of gain or loss on the position.
open_date Date the position was opened
proceeds Total amount received for the order.
quantity Number of shares/contracts
symbol Symbol
term Length of time held (in days)

Example

Command

$ curl -H "Authorization: Bearer {accesstoken}" https://api.tradier.com/v1/user/gainloss

Request

GET /v1/user/gainloss HTTP/1.1
Host: api.tradier.com
Accept: application/xml
Authorization: Bearer 098f6bcd4621d373cade4e832627b4f6
Content-Type: application/x-www-form-urlencoded
User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5

Response

HTTP/1.1 200 OK
Content-Type: application/xml;charset=utf-8
X-Ratelimit-Allowed: 120
X-Ratelimit-Used: 1
X-Ratelimit-Available: 119
X-Ratelimit-Expiry: 1369164360001

<?xml version="1.0" encoding="UTF-8"?>
<accounts>
  <account>
    <account_number>12345678</account_number>
    <gainloss>
      <closed_position>
        <close_date>2013-08-21T22:58:46.427Z</close_date>
        <cost>79.01</cost>
        <gain_loss>-7.07</gain_loss>
        <gain_loss_percent>-8.95</gain_loss_percent>
        <open_date>2013-08-16T22:58:51.267Z</open_date>
        <proceeds>-71.94</proceeds>
        <quantity>1.00000</quantity>
        <symbol>QQQ</symbol>
        <term>5</term>
      </closed_position>
    </gainloss>
  </account>
  <account>
    <account_number>87654321</account_number>
    <gainloss>
      <closed_position>
        <close_date>2013-09-26T22:59:43.380Z</close_date>
        <cost>433.74</cost>
        <gain_loss>-6.74</gain_loss>
        <gain_loss_percent>-1.55</gain_loss_percent>
        <open_date>2013-09-26T22:59:43.373Z</open_date>
        <proceeds>-427.00</proceeds>
        <quantity>25.00000</quantity>
        <symbol></symbol>
        <term>1</term>
      </closed_position>
      <closed_position>
        <close_date>2013-09-26T22:59:43.397Z</close_date>
        <cost>14.01</cost>
        <gain_loss>-11.03</gain_loss>
        <gain_loss_percent>-78.73</gain_loss_percent>
        <open_date>2013-09-26T22:59:43.393Z</open_date>
        <proceeds>-2.98</proceeds>
        <quantity>1.00000</quantity>
        <symbol></symbol>
        <term>1</term>
      </closed_position>
      <closed_position>
        <close_date>2013-09-27T23:00:28.457Z</close_date>
        <cost>107.19</cost>
        <gain_loss>-21.75</gain_loss>
        <gain_loss_percent>-20.29</gain_loss_percent>
        <open_date>2013-09-26T22:59:43.393Z</open_date>
        <proceeds>-85.44</proceeds>
        <quantity>10.00000</quantity>
        <symbol></symbol>
        <term>2</term>
      </closed_position>
    </gainloss>
  </account>
</accounts>

Tradier Inc. and its corresponding technology services (including API services) are distinct and separate from the services provided by Tradier Brokerage Inc. For more information regarding the services of Tradier, Inc., please contact techsupport@tradier.com. For more information regarding the services of Tradier Brokerage, Inc. please contact service@tradierbrokerage.com. Tradier Brokerage Inc. Member FINRA/SIPC

© 2017 Tradier Inc.
  • 11016 Rushmore Drive, Suite 350
  • Charlotte, NC 28277

All materials contained on this site and specifically the API documentation pages are protected by United States copyright law and may not be copied, reproduced, distributed, transmitted, displayed, published or broadcast without the prior written permission of Tradier Inc. The Structure, Format, Layout, Examples and Design of the pages are owned by Tradier Inc, and any efforts to willfully or accidently duplicate a whole or part of the pages on this site is a violation of United States copyright law.