Positions Upload

Learn how to build the positions file

The Positions file is an XML file, uploaded via our API, that is processed by the FundApps Rule Engine to produce Post-Trade results for our different products. The file represents positions held at the end of the trading day.

📘

The upload process of the Position File is a shared process across multiple products

Creating The Positions File

Structure

The structure of the positions file encapsulates a snapshot of the positions held by each Portfolio. For example, a single Equity may be defined as follows:

<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2015-02-22">
    <Instruments>
        <Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP=""/>
    </Instruments> 
    <Portfolios>
        <Portfolio PortfolioId="11">
            <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="10"/>
        </Portfolio>
    </Portfolios>
</Snapshot>
  • Snapshot: Indicates the Date and Time (optional - only for Pre-Trade customers) which the Positions were held (i.e. at the end of the Trading Day).
    • Instruments: Securities or financial instruments mapped to a supported asset class
    • Portfolios: Maps the Assets held by each Portfolio to a single instrument (which may have underlying instruments).

Instruments

Each instrument represents the contract for a traded asset. Instruments are defined by a customer-provided InstrumentId. Each Portfolio can hold multiple assets that refer to the same instruments (with different values for Quantity).

Each instrument should have instrument properties defined as attributes - see our service documentation for the definition of these properties.

Derivatives and convertible securities (such as ADRs or preferred equities) are modelled using a Component field, which must point to a valid underlying instrument by using the InstrumentId.

See examples below for by Asset Class type:

<Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP=""/>
<Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" Price="10" MarketsListedIn="XHEL" />
<Option InstrumentId="CALL_Nokia_PY" InstrumentName="PS Call on Nokia" CallOrPut="Call" IsCashSettled="false" Market="XHEL" ContractSize="100" MaturityDate="2015-11-15" Delta="0.85">
  <Component InstrumentId="FI0009000681" />
</Option>
<Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP="" LotSize="1"/>
<Swap InstrumentId="Swap_Nokia" InstrumentName="Nokia Swap" IsCashSettled="true" MaturityDate="2016-04-05" Market="XHEL" MarketsListedIn="XHEL">
  <Component InstrumentId="FI0009000681"/>
</Swap>
<Equity InstrumentId="G3934K103" InstrumentName="Global SPAC Partners Co - Sub Unit" CUSIP="G3934K103" CountryOfIssue="US" InstrumentCurrency="USD" ISIN="KYG3934K1379" IssuerId="GLOSPACP" IssuerName="Global SPAC Partners Co" MarketsListedIn="XNYS" Market="XNYS" Price="10" ClassSharesOutstanding="30000000" TotalSharesOutstanding="30000000" TotalVotingRights="30000000" TotalVotingShares="30000000" TotalSharesInTreasury="0" VotesPerShare="1" GICSSubIndustries="151030" TotalVotingRightsInTreasury="0" IsWhenIssued="False" TotalVotingSharesInTreasury="0"/>
<Warrant InstrumentId="G3934K111" InstrumentName="Global SPAC Partners Co - Warrant" CallOrPut="Call" ContractSize="1" Delta="1" CUSIP="G3934K111" InControlOfConversion="false" IsCoveredWarrant="true" IsCashSettled="false" Market="XXXX" MaturityDate="2026-11-30" ExerciseStyle="American" MarketsListedIn="XXXX" InstrumentCurrency="USD" AssetClassCustomer="SPAC Warrant">
  <Component InstrumentId="G3934K103"/>
</Warrant>
<Equity InstrumentId="FI0009000681" ISIN="FI0009000681" InstrumentName="Nokia" IssuerId="549300A0JPRWG1KI7U06" LEI="549300A0JPRWG1KI7U06" IssuerName="Nokia" Price="10" CountryOfIncorporation="FI" CountryOfIssue="FI" InstrumentCurrency="EUR" MarketsListedIn="XHEL" Market="XHEL" ClassSharesOutstanding="5587554334" TotalSharesOutstanding="5587554334" TotalVotingShares="5631506659" TotalVotingRights="5631506659" TotalSharesInTreasury="43952325" VotesPerShare="1" GICSSubIndustries="452010"/>
<CFD InstrumentId="CFD_Nokia" InstrumentName="Nokia CFD" ContractSize="1" IsCashSettled="TRUE" IsOTC="FALSE">
  <Component InstrumentId="FI0009000681" />
</CFD>
<Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP="" LotSize="1"/>
<PreferredEquity InstrumentId="FI0014152282" InstrumentName="Nokia Preferred Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0014152282" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="0" Market="XHEL" MarketsListedIn="XHEL" Price="15" CUSIP="" LotSize="1" IsConvertiblePreferred="false"/>
<PreferredEquity InstrumentId="FI1124856280" InstrumentName="Nokia Convertible Preferred Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI1124856280" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="200" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="0" Market="XHEL" MarketsListedIn="XHEL" Price="20" CUSIP="" LotSize="1" IsConvertiblePreferred="true">
  <Component InstrumentId="FI0009000681"/>
</PreferredEquity>
<Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" MarketsListedIn="XBUE,XLON,XNGS" Price="10" CUSIP="" LotSize="1"/>
<ADR InstrumentId="ADR_Vod" InstrumentName="Vod ADR NYSE" ISIN="US92857W2098" Market="XNYS" CUSIP="92857W209" ConversionRatio="2" MarketsListedIn="XNYS">
  <Component InstrumentId="GB00BH4HKS39"/>
</ADR>
<Bond InstrumentId="GV123456789" InstrumentName="USGV123456789 Govt" InstrumentCurrency="USD" IssuerId="US GOV" IssuerName="UNITED STATES" CUSIP="112233445566" ISIN="US123456789" MarketsListedIn="XNYS" Market="XNYS" Price="100" CountryOfIssue="US" DurationAdjustment="1" FaceValue="100" IsGovernmentBacked="true" />
<CDS CUSIP="None" ISIN="Unknown" InstrumentCurrency="USD" InstrumentId="87654321" InstrumentName="US GV CDS" Market="XXXX" MarketsListedIn="XXXX" Notional="200" Price="50">
  <Component InstrumentId="GV123456789"/>
</CDS>
<Rights InstrumentId="FI0009000681" InstrumentName="Nokia Right" ConversionRatio=".01" MaturityDate="2019-05-22" Market="XEGX" MarketsListedIn="XXXX, XEGX" TitleOfClass="Right" Price="25">
  <Component InstrumentId="123"/>
</Rights>
<Equity InstrumentId="123" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="1" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP="" LotSize="1"/>
<Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP="" LotSize="1"/>
<Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" MarketsListedIn="XLON" Price="10" CUSIP="" LotSize="1"/>

<!--If using % weighting for structured products, use the example below-->
<StructuredProduct InstrumentId="SP9000" InstrumentName="Structured Product 9000" InstrumentCurrency="EUR" Price="100" IssuerDomicile="GB">
  <Component InstrumentId="FI0009000681" Weighting="0.7"/>
  <Component InstrumentId="GB00BH4HKS39" Weighting="0.3"/>
</StructuredProduct>
<!--If using quantity weighting for structured products, use the example below-->
<StructuredProduct InstrumentId="SP9000" InstrumentName="Structured Product 9000" InstrumentCurrency="EUR" Price="100000" IssuerDomicile="GB">
  <Component InstrumentId="FI0009000681" WeightingQuantity="7000"/>
  <Component InstrumentId="GB00BH4HKS39" WeightingQuantity="3000"/>
</StructuredProduct>
<Bond InstrumentId="Bond_DE" InstrumentName="DE bond" IssuerId="DE" IssuerName="Germany" ISIN="DE0009000681" DurationAdjustment="0.9" FaceValue="1000" InstrumentCurrency="EUR" IsGovernmentBacked="true" CountryOfIssue="DE" Market="XHEL" MarketsListedIn="XHEL" Price="10"  IsCovered="true"/>

Multiple levels of derivates are also supported for valid Asset classes. Each Component points to the subsequent underlying instrument as in this example:

<Option InstrumentId="CALL(EU)_NL0012365084_CASH" InstrumentName="NSI N.V. - Class A - Cash(EU) Call Option" CallOrPut="Call" ExerciseStyle="European" ContractSize="5" Delta="1" InstrumentCurrency="EUR" IsCashSettled="True" Market="XXXX" MaturityDate="2022-01-14" Price="14" IsOTC="True" DeliveryMonth="2019-07" MarketsListedIn="XXXX">
  <Component InstrumentId="CONV_NL0012365084" />
</Option>  
<Convertible InstrumentId="CONV_NL0012365084" InstrumentName="NSI N.V. - Conv.Bond 5.7% 2031" ISIN="NL00123650CB" Market="XAMS" MarketsListedIn="XAMS" ConversionRatio="10" InControlOfConversion="true" MaturityDate="2031-11-15" Delta="1" IsCoveredConvertible="false">
  <Component InstrumentId="NL0012365084" />
</Convertible>
<Equity InstrumentId="NL0012365084" InstrumentName="NSI N.V." IssuerId="724500I77C30W2LZZJ03" IssuerName="NSI N.V." GICSSubIndustries="251020" ISIN="NL0012365084" InstrumentCurrency="EUR" CountryOfIncorporation="NL" CountryOfIssue="NL" LEI="724500I77C30W2LZZJ03" Market="XAMS" MarketsListedIn="XAMS" Price="17.6" VotesPerShare="1" ClassSharesOutstanding="100000" TotalSharesOutstanding="100000" TotalSharesInTreasury="0" TotalVotingShares="100000" TotalVotingSharesInTreasury="0" TotalVotingRights="100000" TotalVotingRightsInTreasury="0" IsWhenIssued="False" ParValue="0.07" />

Portfolios & Assets

The portfolios list the assets held by a Portfolio for the given Snapshot Date.

  • Each Asset is defined by a unique AssetId provided: Each Asset is tracked day-to-day by a unique AssetId which is a string identifier of the Asset
  • Assets are linked to instrument by InstrumentId: Each Asset is linked to an Instrument (and the defined Instrument Property)
  • Portfolio is identified by PortfolioId: Each portfolio field must point to a Portfolio
  • Assets have distinct properties: See our service documentation for required and optional Asset Properties
<Portfolios>
  <Portfolio PortfolioId="11">
    <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="10" SFTType="Normal"/>
  </Portfolio>
</Portfolios>

Extended Examples

Asset Classes By Use-Case

<Bond InstrumentId="FI0009000681" InstrumentName="Nokia Bond" IssuerId="1" IssuerName="Nokia" ISIN="DE0009000681" DurationAdjustment="0.9" FaceValue="1000" InstrumentCurrency="EUR" IsGovernmentBacked="true" CountryOfIssue="DE" Market="XHEL" MarketsListedIn="XHEL" Price="10" />
<Bond InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC Bond" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="DE0009000681" DurationAdjustment="0.9" FaceValue="1000" InstrumentCurrency="EUR" IsGovernmentBacked="true" CountryOfIssue="DE" Market="XHEL" MarketsListedIn="XHEL" Price="10" />
<Index InstrumentId="MSCI" InstrumentName="MSCI Index" Price="3120.00" InstrumentCurrency="USD">
  <Component InstrumentId="FI0009000681" Weighting="0.7"/>
  <Component InstrumentId="GB00BH4HKS39" Weighting="0.3"/>
</Index>
<Future InstrumentId="BondIndexFuture" InstrumentName="MSCI EAFE Future" ISIN="FUT900090001" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL" ContractSize="100" CUSIP="123456789" CommoditySymbol="MSF" DeliveryMonth="2018-12" MaturityDate="2018-12-15" ExercisePrice="3120" Notional="2000" InstrumentCurrency="USD">
  <Component InstrumentId="MSCI"/>
</Future>
<Bond InstrumentId="Evil Bond" Instrumentname="Evil Corporate Bond" IssuerId="EvilCorp" IssuerName="Evil Corporation" CountryOfIssue="GB" CUSIP="123456789" FaceValue="1000" ISIN="ABC123456789"  Market="XLON" MarketsListedIn="XLON" TitleOfClass="EVIL"/>
<Future InstrumentId="BondFuture" InstrumentName="Evil Bond Future" ISIN="FUT900090001" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL" CUSIP="123456789" CommoditySymbol="ZBM1" DeliveryMonth="2018-12" MaturityDate="2018-12-15" ExercisePrice="3120" Notional="3000">
  <Component InstrumentId="Evil Bond"/>
</Future> 
<Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" Price="10" MarketsListedIn="XHEL" />
<Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" Price="10" MarketsListedIn="XLON" />
<Index InstrumentId="MSCI" InstrumentName="MSCI Index" Price="3120.00" InstrumentCurrency="USD">
  <Component InstrumentId="FI0009000681" Weighting="0.7"/>
  <Component InstrumentId="GB00BH4HKS39" Weighting="0.3"/>
</Index>
<Future InstrumentId="MSCIEAFEFuture" InstrumentName="MSCI EAFE Future" ISIN="FUT900090001" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL"  ContractSize="100" CUSIP="123456789" CommoditySymbol="MSF" DeliveryMonth="2018-12" MaturityDate="2018-12-15" ExercisePrice="3120" Notional="3000">
  <Component InstrumentId="MSCI"/>
</Future> 
<Bond InstrumentId="German Bond 1" InstrumentName="German Bond 1" InstrumentCurrency="EUR" IssuerId="Germany" IssuerName="Germany"  ISIN="DE0001102317" MarketsListedIn="XFRA" Market="XFRA" Price="100" CountryOfIssue="DE" DurationAdjustment="1" FaceValue="100" IsGovernmentBacked="true" />
<Bond InstrumentId="Netherlands Bond 1" InstrumentName="Netherlands Bond 1" InstrumentCurrency="EUR" IssuerId="Netherlands" IssuerName="Netherlands" ISIN="NL0009446418" MarketsListedIn="XAMS" Market="XAMS" Price="100" CountryOfIssue="NL" DurationAdjustment="1" FaceValue="100" IsGovernmentBacked="true" />  
<Index InstrumentId="S and P Eurozone Sovereign Bond Index" InstrumentName="S and P Eurozone Sovereign Bond Index" Price="3120.00" InstrumentCurrency="EUR" >
  <Component InstrumentId="German Bond 1" Weighting="0.1"/>
  <Component InstrumentId="Netherlands Bond 1" Weighting="0.1"/>
</Index>   
<Option InstrumentId="OptionIndexSovBond" InstrumentName="OptionIndexSovBond" CallOrPut="Call" ExerciseStyle="European" ContractSize="10" Delta="0.5" InstrumentCurrency="EUR" IsCashSettled="True" Market="XFRA" MaturityDate="2023-09-29" Price="14" IsOTC="FALSE" DeliveryMonth="2019-07" MarketsListedIn="XFRA" Notional="100000">
  <Component InstrumentId="S and P Eurozone Sovereign Bond Index" />
</Option>

Position Files By Use-Case

<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2015-02-22">
  <Instruments>
    <Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP="" LotSize="1"/>
    <Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" MarketsListedIn="XBUE,XLON,XNGS" Price="10" CUSIP="" LotSize="1"/>
    <PreferredEquity InstrumentId="FI0014152282" InstrumentName="Nokia Preferred Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0014152282" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="0" Market="XHEL" MarketsListedIn="XHEL" Price="15" CUSIP="" LotSize="1" IsConvertiblePreferred="false"/>
    <PreferredEquity InstrumentId="FI1124856280" InstrumentName="Nokia Convertible Preferred Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI1124856280" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="200" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="0" Market="XHEL" MarketsListedIn="XHEL" Price="20" CUSIP="" LotSize="1" IsConvertiblePreferred="true">
        <Component InstrumentId="FI0009000681"/>
    </PreferredEquity>
    <ADR InstrumentId="ADR_Vod" InstrumentName="Vod ADR NYSE" ISIN="US92857W2098" Market="XNYS" CUSIP="92857W209" ConversionRatio="2" MarketsListedIn="XNYS">
      <Component InstrumentId="GB00BH4HKS39"/>
    </ADR>
    <Convertible InstrumentId="Conv_Nokia" InstrumentName="Nokia CB 6.2% 2018" IssuerId="1" IssuerName="Nokia" ISIN="FI00B16GWD58" Market="XHEL" MarketsListedIn="XHEL" CUSIP="" ConversionRatio="2" InControlOfConversion="true" MaturityDate="2015-11-15" Delta="0.35" IsCoveredConvertible="False">
      <Component InstrumentId="FI0009000681"/>
    </Convertible>
    <Warrant InstrumentId="Warrant_Nokia" InstrumentName="Nokia Warrant" CallOrPut="Call" InControlOfConversion="true" IsCoveredWarrant="true" IsCashSettled="true" ContractSize="1" MaturityDate="2015-11-15" Market="XHEL" MarketsListedIn="XHEL" Delta="0.35">
      <Component InstrumentId="FI0009000681"/>
    </Warrant>
    <Rights InstrumentId="Right_Nokia" InstrumentName="Nokia Right" ConversionRatio="3" MaturityDate="2015-11-15" Market="XHEL" MarketsListedIn="XHEL">
      <Component InstrumentId="FI0009000681"/>
    </Rights>
    <Option InstrumentId="CALL_Nokia_PY" InstrumentName="PS Call on Nokia" CallOrPut="Call" IsCashSettled="false" Market="XHEL" ContractSize="100" MaturityDate="2015-11-15" Delta="0.85">
      <Component InstrumentId="FI0009000681"/>
    </Option>
    <Option InstrumentId="CALL_Nokia_CS" InstrumentName="CS Call on Nokia" CallOrPut="Call" IsCashSettled="true" Market="XHEL" ContractSize="100" MaturityDate="2015-11-15" Delta="0.75">
      <Component InstrumentId="FI0009000681"/>
    </Option>
    <Swap InstrumentId="Swap_Nokia" InstrumentName="Nokia Swap" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL">
      <Component InstrumentId="FI0009000681"/>
    </Swap>
    <CFD InstrumentId="CFD_Nokia" InstrumentName="Nokia CFD" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL">      
      <Component InstrumentId="FI0009000681"/>
    </CFD>
    <Future InstrumentId="Fut_STOXX_600" InstrumentName="STOXX 600 SXXP Index Future" ISIN="FUT900090001" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL"  ContractSize="100" CUSIP="123456789" CommoditySymbol="FXXP" DeliveryMonth="2015-12" MaturityDate="2015-12-15" ExercisePrice="3120" Notional="3000">
      <Component InstrumentId="SXXP"/>
    </Future>
    <Index InstrumentId="SXXP" InstrumentName="STOXX 600" Price="3120.00" InstrumentCurrency="EUR">
      <Component InstrumentId="FI0009000681" Weighting="0.5"/>
      <Component InstrumentId="GB00BH4HKS39" Weighting="0.5"/>
    </Index>
    <Unit InstrumentId="iShares_Developed_Markets_ETF" InstrumentName="iShares_Developed_Markets_ETF" IssuerId="iShares_Developed_Markets_ETF" IssuerName="iShares Developed Markets ETF" ISIN="None" CUSIP="921943858" TotalSharesOutstanding="1000" ClassSharesOutstanding="1000" TotalVotingRights="1000" Price="2000" InstrumentCurrency="USD" Market="XNYS" MarketsListedIn="XNYS" VotesPerShare="1" IsETF="true">
      <Component InstrumentId="FI0009000681" Weighting="0.55"/>
      <Component InstrumentId="GB00BH4HKS39" Weighting="0.45"/>
    </Unit> 
  </Instruments>
  <Portfolios>
    <Portfolio PortfolioId="11">
      <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="10" SFTType="Normal"/>
      <Asset AssetId="FI0009000681PSCALL2015-11-15" AssetName="PS Call on Nokia" InstrumentId="CALL_Nokia_PY" Quantity="1" SFTType="Normal"/>
      <Asset AssetId="FI0009000681CS2015-11-15" AssetName="CS Call on Nokia" InstrumentId="CALL_Nokia_CS" Quantity="1" SFTType="Normal"/>
      <Asset AssetId="FI00B16GWD58XHEL" AssetName="Nokia CB 6.2% 2018" InstrumentId="Conv_Nokia" Quantity="10" SFTType="Normal"/>
      <Asset AssetId="FI0009000681WarrantXHEL" AssetName="Nokia Warrant" InstrumentId="Warrant_Nokia" Quantity="10" SFTType="Normal"/>
      <Asset AssetId="FI0009000681RightXHEL" AssetName="Nokia Right" InstrumentId="Right_Nokia" Quantity="10" SFTType="Normal"/>
      <Asset AssetId="FI0009000681SWAPXHEL" AssetName="Nokia Swap" InstrumentId="Swap_Nokia" Quantity="10" SFTType="Normal"/>
      <Asset AssetId="FI0009000681CFDXHEL" AssetName="Nokia CFD" InstrumentId="CFD_Nokia" Quantity="10" SFTType="Normal"/>
      <Asset AssetId="SXXPFutureXHEL" AssetName="STOXX 600 SXXP Index Future" InstrumentId="Fut_STOXX_600" Quantity="-1" SFTType="Normal"/>
      <Asset AssetId="921943858" AssetName="iShares Developed Markets ETF" InstrumentId="iShares_Developed_Markets_ETF" Quantity="10" SFTType="Normal"/>
    </Portfolio>
  </Portfolios>
</Snapshot>
<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2015-02-22">
    <Instruments>
        <Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" MarketsListedIn="XHEL" Price="10" CUSIP="" LotSize="1" TotalVotingRightsInTreasury="0"/>
    </Instruments>
    <Portfolios>
        <Portfolio PortfolioId="11">
            <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="10" SFTType="Normal"/>
        </Portfolio>
        <Portfolio PortfolioId="12">
            <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="30" SFTType="Normal"/>
        </Portfolio>
    </Portfolios>
</Snapshot>
<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2015-02-22">
    <Instruments>
        <Equity InstrumentId="GB0009000681" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB0009000681" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" MarketsListedIn="XLON" Price="10" CUSIP="" LotSize="1"/>
    </Instruments>
    <Portfolios>
        <Portfolio PortfolioId="11">
            <Asset AssetId="GB0009000681XLONNormal" AssetName="Equity1" InstrumentId="GB0009000681" Quantity="10" SFTType="Normal"/>
            <Asset AssetId="GB0009000681XLONNormalBorrow" AssetName="Equity1-Borrow" InstrumentId="GB0009000681" Quantity="10" SFTType="Borrowed" HasTransferOfTitle="true" HasTransferOfVotingPower="true"/>
            <Asset AssetId="GB0009000681XLONNormalBorrowLent" AssetName="Equity1-on-lent" InstrumentId="GB0009000681" Quantity="5" SFTType="Lent" HasTransferOfTitle="true" HasTransferOfVotingPower="false" />
        </Portfolio>
    </Portfolios>
</Snapshot>
<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2018-08-29">
    <Instruments>
        <Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" Price="10" MarketsListedIn="XHEL" />
        <Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" Price="10" MarketsListedIn="XLON" />
        <Index InstrumentId="MSCI" InstrumentName="MSCI Index" Price="3120.00" InstrumentCurrency="USD">
            <Component InstrumentId="FI0009000681" Weighting="0.7"/>
            <Component InstrumentId="GB00BH4HKS39" Weighting="0.3"/>
        </Index>
        <Future InstrumentId="MSCIEAFEFuture" InstrumentName="MSCI EAFE Future" ISIN="FUT900090001" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL"  ContractSize="100" CUSIP="123456789" CommoditySymbol="MSF" DeliveryMonth="2018-12" MaturityDate="2018-12-15" ExercisePrice="3120" Notional="3000">
            <Component InstrumentId="MSCI"/>
        </Future> 
    </Instruments>
    <Portfolios>
        <Portfolio PortfolioId="9000">
            <Asset AssetId="GB00BH4HKS39XLON" AssetName="Vodafone Equity" InstrumentId="GB00BH4HKS39" Quantity="30000" SFTType="Normal"/>
            <Asset AssetId="FUT900090001XHEL" AssetName="MSCI EAFE Future" InstrumentId="MSCIEAFEFuture" Quantity="30000" SFTType="Normal"/>
            <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="30000" SFTType="Normal"/>
        </Portfolio>
    </Portfolios>
</Snapshot>
<!-- NOTE: This is for customers who have requested the 'Desk-Level Assets' feature -->
<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2018-08-29">
    <Instruments>
        <Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" Price="10" MarketsListedIn="XHEL" />
        <Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" Price="10" MarketsListedIn="XLON" />
        <Index InstrumentId="MSCI" InstrumentName="MSCI Index" Price="3120.00" InstrumentCurrency="USD">
            <Component InstrumentId="FI0009000681" Weighting="0.7"/>
            <Component InstrumentId="GB00BH4HKS39" Weighting="0.3"/>
        </Index>
        <Future InstrumentId="MSCIEAFEFuture" InstrumentName="MSCI EAFE Future" ISIN="FUT900090001" IsCashSettled="true" Market="XHEL" MarketsListedIn="XHEL"  ContractSize="100" CUSIP="123456789" CommoditySymbol="MSF" DeliveryMonth="2018-12" MaturityDate="2018-12-15" ExercisePrice="3120" Notional="3000">
            <Component InstrumentId="MSCI"/>
        </Future> 
    </Instruments>
    <Portfolios>
        <Portfolio PortfolioId="9000">
            <Asset AssetId="GB00BH4HKS39XLON" AssetName="Vodafone Equity" InstrumentId="GB00BH4HKS39" Quantity="30000" SFTType="Normal"/>
            <Asset AssetId="FUT900090001XHEL" AssetName="MSCI EAFE Future" InstrumentId="MSCIEAFEFuture" Quantity="30000" SFTType="Normal"/>
            <Asset AssetId="FI0009000681XHEL" AssetName="Nokia Equity" InstrumentId="FI0009000681" Quantity="30000" SFTType="Normal"/>
        </Portfolio>
    </Portfolios>
</Snapshot>
<?xml version="1.0" ?>
<Snapshot Date="2017-12-29">
  <Instruments>
    <Equity InstrumentId="88579Y101" CUSIP="88579Y101" InstrumentCurrency="USD" Price="217.82" InstrumentName="3M CO" />
    <Equity InstrumentId="83001A102" CUSIP="83001A102" InstrumentCurrency="USD" Price="60.72" InstrumentName="SIX FLAGS ENTMT" />
    <Equity InstrumentId="037833100" CUSIP="037833100" InstrumentCurrency="USD" Price="160.22" InstrumentName="APPLE INC A" />
    <Equity InstrumentId="191216100" CUSIP="191216100" InstrumentCurrency="USD" Price="46.21" InstrumentName="COCA COLA" />
    <Equity InstrumentId="594918104" CUSIP="594918104" InstrumentCurrency="USD" Price="77.62" InstrumentName="MICROSOFT CORP A" />
    <Equity InstrumentId="121220107" CUSIP="121220107" InstrumentCurrency="USD" Price="35.50" InstrumentName="BURGER KING INC" />
    <Equity InstrumentId="580135101" CUSIP="580135101" InstrumentCurrency="USD" Price="165.44" InstrumentName="MCDONALDS CORP" />
    <Equity InstrumentId="68389X105" CUSIP="68389X105" InstrumentCurrency="USD" Price="49.22" InstrumentName="ORACLE CORP" />
    <Equity InstrumentId="000375204" CUSIP="000375204" InstrumentCurrency="USD" Price="24.95" InstrumentName="ABB LTD" />
  </Instruments>
  <Portfolios>
    <Portfolio PortfolioId="14">
      <Asset InstrumentId="88579Y101" AssetId="1" SFTType="Normal" Quantity="99999" AssetName="3M CO" />
      <Asset InstrumentId="83001A102" AssetId="2" SFTType="Normal" Quantity="99895" AssetName="SIX FLAGS ENTMT" />
      <Asset InstrumentId="037833100" AssetId="3" SFTType="Normal" Quantity="99999" AssetName="APPLE INC A" />
      <Asset InstrumentId="191216100" AssetId="4" SFTType="Normal" Quantity="96531" AssetName="COCA COLA" />
      <Asset InstrumentId="594918104" AssetId="5" SFTType="Normal" Quantity="93500" AssetName="MICROSOFT CORP A" />
      <Asset InstrumentId="121220107" AssetId="6" SFTType="Normal" Quantity="89010" AssetName="BURGER KING INC" />
      <Asset InstrumentId="580135101" AssetId="7" SFTType="Normal" Quantity="99999" AssetName="MCDONALDS CORP" />
      <Asset InstrumentId="68389X105" AssetId="8" SFTType="Normal" Quantity="96932" AssetName="ORACLE CORP" />
      <Asset InstrumentId="000375204" AssetId="9" SFTType="Normal" Quantity="89491" AssetName="ABB LTD" />
    </Portfolio>
    <Portfolio PortfolioId="17">
      <Asset InstrumentId="88579Y101" AssetId="88579Y101" SFTType="Normal" Quantity="99000" AssetName="3M CO" />
    </Portfolio>
  </Portfolios>
</Snapshot>
<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2015-02-22">
    <Instruments>
        <Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" MarketsListedIn="XLON" Price="10" CUSIP="" LotSize="1"/>
        <ADR InstrumentId="US92857W2098" InstrumentName="Vod ADR NYSE" ISIN="US92857W2098" Market="XNYS" CUSIP="92857W209" ConversionRatio="2" MarketsListedIn="XNYS">
            <Component InstrumentId="GB00BH4HKS39"/>
        </ADR>
    </Instruments>
    <Portfolios>
        <Portfolio PortfolioId="11">
            <Asset AssetId="US92857W2098XNYS" AssetName="Vodafone ADR" InstrumentId="US92857W2098" Quantity="14000"/>
        </Portfolio>
        <Portfolio PortfolioId="12">
            <Asset AssetId="GB00BH4HKS39XLON" AssetName="Vodafone Equity" InstrumentId="GB00BH4HKS39" Quantity="30000"/>
        </Portfolio>
    </Portfolios>
</Snapshot>
<?xml version="1.0" encoding="UTF-8"?>
<Snapshot Date="2015-02-22">
  <Instruments>
    <Equity InstrumentId="FI0009000681" InstrumentName="Nokia Equity" IssuerId="1" IssuerName="Nokia" ISIN="FI0009000681" CountryOfIssue="FI" CountryOfIncorporation="FI" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XHEL" Price="10" MarketsListedIn="XHEL" HasAlternateUSSection12Registration="false" />
    <Equity InstrumentId="GB00BH4HKS39" InstrumentName="Vodafone Group PLC" IssuerId="2" IssuerName="Vodafone Group PLC" ISIN="GB00BH4HKS39" CountryOfIssue="GB" CountryOfIncorporation="GB" TotalVotingRights="3000" ClassSharesOutstanding="1000" TotalSharesOutstanding="2000" TotalSharesInTreasury="200" MarketCap="1000" InstrumentCurrency="GBP" VotesPerShare="3" Market="XLON" Price="10" MarketsListedIn="XLON" HasAlternateUSSection12Registration="false"/>
    <ADR InstrumentId="US92857W2098" InstrumentName="Vod ADR NYSE" ISIN="US92857W2098" Market="XNYS" CUSIP="92857W209" ConversionRatio="2" MarketsListedIn="XNYS">
      <Component InstrumentId="GB00BH4HKS39"/>
    </ADR>
    <Option InstrumentId="CALL_Nokia_CS" InstrumentName="CS Call on Nokia" CallOrPut="Call" IsCashSettled="true" Market="XHEL"  ContractSize="100" MaturityDate="2015-11-15" Delta="0.75">
      <Component InstrumentId="FI0009000681"/>
    </Option>
  </Instruments>
  <Portfolios>
    <Portfolio PortfolioId="11">
      <Asset AssetId="GB00BH4HKS39XLON" AssetName="Vodafone Equity" InstrumentId="GB00BH4HKS39" Quantity="10000"/>
      <Asset AssetId="US92857W2098XNYS" AssetName="Vodafone ADR" InstrumentId="US92857W2098" Quantity="14000"/>
    </Portfolio>
    <Portfolio PortfolioId="12">
      <Asset AssetId="GB00BH4HKS39XLON" AssetName="Vodafone Equity" InstrumentId="GB00BH4HKS39" Quantity="30000"/>
    </Portfolio>
  </Portfolios>
</Snapshot>

Creating The XML In Code

using System;
using System.Xml.Linq;

public class Program
{
    public static void Main()
    {
        var snapShot = new XElement("Snapshot", new XAttribute("DataDate", DateTime.Today.ToString("yyyy-MM-dd")));
        var instruments = new XElement("Instruments");
        instruments.Add(CreateInstrument("Equity", "1", "HSBC Class A"));
        instruments.Add(CreateInstrument("Equity", "2", "Facebook"));
        CreateInstrumentWithSingleUnderlying(instruments, "EquityOption", "3", "Call Option On Facebook");
        //In a loop add all instruments from all portfolios
        snapShot.Add(instruments);
        var portfolios = new XElement("Portfolios");
        portfolios.Add(CreatePortfolio("P123"));
				portfolios.Add(CreatePortfolio("P456"));
        //In a loop add all portfolios
        snapShot.Add(portfolios);
        Console.WriteLine(new XDocument(snapShot));
    }
  
    public static XElement CreateInstrument(string assetClass, string instrumentId, string instrumentName) 
    { 
        return new XElement(assetClass,
            new XAttribute("InstrumentId", instrumentId),
            new XAttribute("InstrumentName", instrumentName));
            //Add all other required instrument properties per asset class from https://docs.fundapps.co/disclosureProperties.html#InstrumentProperties
    }
  
    public static void CreateInstrumentWithSingleUnderlying(XElement instruments, string assetClass, string instrumentId, string instrumentName) 
    { 
			var underlyingInstrumentId = "U" + instrumentId;
			instruments.Add(CreateInstrument("Equity", underlyingInstrumentId, "U"+ instrumentName));
			var derivative = CreateInstrument("Option", instrumentId, instrumentName);
			derivative.Add(new XElement("Component", new XAttribute("InstrumentId", underlyingInstrumentId)));
			instruments.Add(derivative);
    }
  
		public static XElement CreatePortfolio(string portfolioId)
    {
        var portfolio = new XElement("Portfolio", new XAttribute("PortfolioId", portfolioId));
        portfolio.Add(CreateAsset(portfolioId, "1", 100));
        portfolio.Add(CreateAsset(portfolioId, "2", 200));
        portfolio.Add(CreateAsset(portfolioId, "3", 300));
        //In a loop add all assets for this portfolio
        return portfolio;
    }
  
    public static XElement CreateAsset(string portfolioId, string instrumentId, int quantity) 
    {
        return new XElement("Asset", 
            new XAttribute("AssetId", portfolioId+"/"+instrumentId),
            new XAttribute("InstrumentId", instrumentId),
            new XAttribute("Quantity", quantity));
            //Add all other required instrument properties per asset class from https://docs.fundapps.co/disclosureProperties.html#AssetProperties
    }
}

Upload

Using Our XSD schema

We make an XSD schema available for the position upload XML format; this may be retrieved from the Expost XSD API endpoint. If you don't have access to an environment yet and would like access to an XSD file, please contact support.

Uploading The File

To upload the file, use the Expost Check endpoint and attach the positions file to the request. Both XML and ZIP formats are supported; For setting a file type and file name, use the Content-Type and X-ContentName headers respectively, as in the sample below.

Sample Code Scripts

// Example for using HttpClient (dotnet-core)

// Create a client which will connect to the HTTPS endpoint with the API credentials you have been provided
var client = new HttpClient();
var authValue = Convert.ToBase64String(Encoding.ASCII.GetBytes("[USERNAME]:[PASSWORD]"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authValue);

// make the HTTP post request body
// use these lines if you wish to send an XML file
var content = new ByteArrayContent(File.ReadAllBytes("positions.xml"));
content.Headers.Add("Content-Type", "text/xml");

// use these lines if you wish to send a zip file, and be sure to end the file name with .zip
// var content = new ByteArrayContent(File.ReadAllBytes("positions.zip"));
// content.Headers.Add("Content-Type", "application/zip");

//use this line to specify a name for the uploaded file
content.Headers.Add("X-ContentName", "positions-monday.xml");

var response = await client.PostAsync("https://[ALIAS]-api.fundapps.co/v1/expost/check", content);
// if response comes back with a 2xx status, then file was received successfully
if ((response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.Accepted))
{
    throw new Exception($"Failed to send file. Received a HTTP {(int) response.StatusCode} {response.StatusCode} instead of HTTP 200 OK");
}
// successfully sent file to FundApps
package co.fundapps.examples;

import org.apache.hc.client5.http.fluent.Executor;
import org.apache.hc.client5.http.fluent.Request;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**
 * Simple example uses Apache Http Client Fluent API to handle basic authentication and post a pre-existing XML
 * document to the FundApps API
 */
public class UploadPositionFile {

    // replace with your company name
    public static final String CLIENT = "client";
    // replace with your username
    public static final String USERNAME = "api-user";
    // replace with your password
    public static final String PASSWORD = "";

    public static void main(String[] args) throws URISyntaxException, IOException {
        HttpHost fundAppsHost = HttpHost.create(String.format("https://%s-api.fundapps.co", CLIENT));
        String endpoint = String.format("%s/v1/expost/check", fundAppsHost.toURI());

        System.out.println("endpoint = " + endpoint);

        Request postPositions = Request.post(endpoint).bodyFile(new File("positions.xml"), ContentType.TEXT_XML);
        Executor executor = Executor.newInstance().auth(fundAppsHost, USERNAME, PASSWORD.toCharArray());

        // make http request
        HttpResponse response = executor.execute(postPositions).returnResponse();

        // check response is as expected
        if(response.getCode() == HttpStatus.SC_ACCEPTED ||response.getCode() == HttpStatus.SC_OK){
            System.out.println("File submitted");
        } else {
            System.err.printf("Error submitting file. HTTP Status Code was: %d", response.getCode());
        }

    }

}
// Example using request (https://github.com/request/request)

const request = require('request');
const fs = require('fs');

// if response comes back with a 2xx status, then file was received successfully
function logResult(error, response, body) {
  console.log(error);
  console.log(response.statusCode);
  console.log(response.headers['content-type']);
  console.log(body);
}

function requestOptions(data) {
  return {
    headers: {
      // use this line to specify a name for the uploaded file
      'X-ContentName': [POSITIONS FILE NAME],
      // use this line to define the file type. e.g. 'text/xml', 'application/zip'
      'Content-Type': [POSITIONS FILE TYPE],
    },
    // connect to the HTTPS endpoint with the API credentials you have been provided
    uri: 'https://[ALIAS]-api.fundapps.co/v1/expost/check',
    method: 'POST',
    body: data,
    auth: {
      user: [USERNAME],
      pass: [PASSWORD],
      sendImmediately: false,
    },
  };
}

function sendFile(data) {
  request(requestOptions(data), logResult);
}

fs.readFile([POSITIONS FILE], (error, data) => {
  if (error == null) {
    sendFile(data);
  } else {
    console.log(error);
  }
});
# FundApps Example PowerShell API Integration
#
# Usage:
# $Result = Expost-Check -APIUri "https://[ALIAS]-api.fundapps.co" -User "user" -Password "pass" -File "TestUpload.xml"
# Get-ValidationState -APIUri "https://[ALIAS]-api.fundapps.co" -User "user" -Password "pass" -Result $Result
# Portfolios-Import -APIUri "https://[ALIAS]-api.fundapps.co" -User "user" -Password "pass" -File "Portfolios.csv"
# Portfolios-Import-Ignore-Unknowns -APIUri "https://[ALIAS]-api.fundapps.co" -User "user" -Password "pass" -File "Portfolios.csv"
# For how to encrypt passwords on a machine before using as a parameter see here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/convertto-securestring?view=powershell-7

function API-Post {
    Param ($Uri, $User, $Password, $File)
    $basicAuth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($($User) + ":" + $($Password)));
	$fileName = Split-Path $File -leaf
    $params = @{
        Uri = $Uri
        Method = 'Post'
        Headers = @{ Authorization = $basicAuth; 'X-ContentName' = $fileName}
        ContentType = Get-Content-Type -Filename $File
        InFile = $File
    }
    Invoke-RestMethod @params
}

function API-Get {
    Param ($Uri, $User, $Password)
    $basicAuth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($($User) + ":" + $($Password)));
    $params = @{
        Uri = $Uri
        Method = 'Get'
        Headers = @{ Authorization = $basicAuth }
    }
    Invoke-RestMethod @params
}

function Get-Content-Type {
    Param (
        [Parameter(Mandatory=$True)]
        [string] $Filename
    )
    $extension = [System.IO.Path]::GetExtension($Filename)
    $contentType = "Unknown"
    switch($extension)
    {
        '.xls' { $contentType = "application/vnd.ms-excel"}
        '.xlsx' { $contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}
        '.xml' { $contentType = "application/xml"}
        '.zip' { $contentType = "application/zip" }
        '.csv' { $contentType = "text/csv" }
    }
    return $contentType
}

function Import-File {
  Param ($Uri, $User, $Password, $File)
    API-Post -Uri $Uri -User $User -Password $Password -File $File
}

function Expost-Check {
    Param ($APIUri, $User, $Password, $File)
    Import-File -User $User -Password $Password -File $File -Uri ($APIUri + "/v1/expost/check")
}

function Portfolios-Import {
    Param ($APIUri, $User, $Password, $File)
    Import-File -User $User -Password $Password -File $File -Uri ($APIUri + "/v1/portfolios/import")
}

function Portfolios-Import-Ignore-Unknowns {
    Param ($APIUri, $User, $Password, $File)
    Import-File -User $User -Password $Password -File $File -Uri ($APIUri + "/v1/portfolios/import?ignoreUnknownProperties=true")
}

function Get-ValidationState {
    Param ($APIUri, $User, $Password, $Result)
    $State = Api-Get -Uri ($APIUri + $Result.links.result) -User $User -Password $Password
    $State.ResultsSnapshot
}
import requests as req
from requests.auth import HTTPBasicAuth
import xml
from xml.etree import ElementTree
import time

############
# PLEASE POPULATE FOUR VARIABLES BELOW TO TEST, PLEASE USE PYTHON 3.6 OR ABOVE
###########

client_environment  = '' 
api_user            = ''
api_password        = '' # NOTE: please be conscious when sharing this file as this password will allow API access
positions_file      = '' # XML or ZIP file

###########

base_url = f'https://{client_environment}-api.fundapps.co'
auth = HTTPBasicAuth(api_user, api_password)
files = {'file': (positions_file, open(positions_file, 'rb'), 'text/XML')}
r = req.post(f'{base_url}/v1/expost/check', auth=auth, files=files)

if r.status_code == 202:
    print('File accepted.')
    xml_response = ElementTree.fromstring(r.content)
    result_tracking_url = f'{base_url}{xml_response[0].text}'

    r = req.get(result_tracking_url, auth=auth)
    
    while r.status_code == 202:
        print('Upload in progress. Waiting 20 seconds before checking again.')
        time.sleep(20)
        r = req.get(result_tracking_url, auth=auth)
        
    print('Upload complete. Result XML:\n', r.text)
else:
    print(f'Unexpected error response from FundApps API. HTTP Status code:{r.status_code}, reason:{r.reason}')
#!/usr/bin/env bash

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

SAMPLE_DATA_DIR=$DIR/../Sample-ImportFiles

read -p "Enter Username: " USERNAME
read -s -p "Enter Password: " PASSWORD
printf "\n"
read -p "Enter API URL: " API_URL

function API-Post {
  curl -X POST -u $USERNAME:$PASSWORD\
    $API_URL/$1 -H "Content-Type: application/xml" -H "X-ContentName: positions.xml"\
    --data-binary "@$2" -o intermediate.xml
}

function API-Get {
  curl -X GET -u $USERNAME:$PASSWORD\
    $API_URL/$1\
     --verbose -o result.xml
}

printf ">>> Uploading Position File.. \n\n"
API-Post "v1/expost/check" "$SAMPLE_DATA_DIR/positions.xml"
printf "\n>>> Server Response (intermediate.xml): "
cat intermediate.xml
RESULT_URL=`cat intermediate.xml | grep -oP '(?<=result>)[^<]+'`
printf "\n\n>>> HTTP GET result url[$RESULT_URL]..\n\n"
API-Get "$RESULT_URL"
printf "\n>>> Result Summary \n\n"
cat result.xml
require 'RestClient'
require 'Oga'
require 'colorize'

# FundApps Example Ruby API Integration
#
# Usage:
# ... (run 'bundle install' to restore gems from Gemfile) ...
#
# fundapps_api = FundAppsAPI.new endpoint: "http://fundapps.local:38727", username: 'awhite', password: 'password'
# fundapps_api.import_positions file: 'SamplePositions_Simple.zip'
# fundapps_api.import_positions_and_get_result file: 'Disclosure_US_1Day.zip'
# fundapps_api.import_portfolios file: 'Portfolios.csv'
# fundapps_api.import_portfolios_ignore_unknowns file: 'Portfolios.csv'
# puts fundapps_api.xsd

class FundAppsAPI
  def initialize (endpoint:, username:, password:)
    @endpoint_root = endpoint
    @username = username
    @password = password
    @content_types = {
      '.csv' => 'text/csv',
      '.xml' => 'application/xml',
      '.zip' => 'application/zip'
    }
  end

  def import_positions (file:) post "/v1/expost/check", file end
  def import_portfolios (file:) post "/v1/portfolios/import", file end
  def import_portfolios_ignore_unknowns (file:) post "/v1/portfolios/import?ignoreUnknownProperties=true", file end
  def xsd; get "/v1/expost/xsd"; end

  private

  def post (endpoint, file)
    url = @endpoint_root + endpoint
    extension = File.extname(file)
    puts "Unrecognized file type" unless @content_types.include?(extension)

    response = RestClient::Request.execute(:method => :post,
      :url => url,
      :user => @username,
      :password => @password,
      :payload => File.read(file),
      :headers => { :content_type => @content_types[extension], :'x-contentname' => File.basename(file) },
      :timeout => nil
    )
    wait_for_expost_result(response) if endpoint == "/v1/expost/check"
    rescue RestClient::ExceptionWithResponse => e
      puts e
      puts "Failed to send file to FundApps. Received a #{e.http_code} HTTP response from #{url}"
  end

  def get (endpoint)
    url = @endpoint_root + endpoint
    response = RestClient::Request.execute(:method => :get,
      :url => url,
      :user => @username,
      :password => @password
    )
    rescue RestClient::ExceptionWithResponse => e
      puts "Failed to make request. Received a #{e.http_code} HTTP response from #{url}"
  end

  def wait_for_expost_result (response)
    result_url = Oga.parse_xml(response).xpath('//links/result').first.text
    done = false
    result_status = {}
    while not done
      result_status = Oga.parse_xml(get(result_url))
      results_snapshot = result_status.xpath('/ResultsSnapshot').first
      results_snapshot.attributes.each do |attribute|
        result_status[attribute.name.to_sym] = attribute.value
      end
      done = true if result_status[:PipelineStage] == "Finished"
    end
    puts response.colorize(:red) if result_status[:Status] == "ValidationFailed"
  end
end

Sample Request & Response

(Request Headers)
POST https://%company%-api.fundapps.co/v1/expost/check HTTP/1.1 Content-Type: "application/xml" X-ContentName: "positions_04-06-2023.xml"

(Response)
<links>
  <result>/v1/ExPost/Result/fe633307-f196-4609-abfe-a1fc0111e875</result>
</links>

Checking The Upload Status

By polling the Expost Result endpoint, using the endpoint returned from the Expost Check endpoint, the status of the current file upload can be checked.

This endpoint returns a 202 Accepted HTTP status whilst the check is in progress and a 200 OK status when the check is complete. The progress of validation and rule execution is reported separately in the response.

ValidationStateRuleStateExplanation
UnknownUnknownJob just received; not processed yet
PendingPendingJob queued
InProgressPendingValidation in progress
PassedInProgressRule execution in progress
FailedNotRunValidation failed; rule processing cancelled
PassedFailedRule execution failed
PassedPassedRule execution successful

When the rule execution is completed successfully, an additional 'Summary' element is provided in the response. This aims to provide the same information as the email notification sent when a positions file finishes processing.

The Summary element is comprised of:

  • The total number of alerts by type - i.e. Breach, Unknown, etc.
  • The number of new alerts by type (since the most recent NavDate).

Sample

(Request)
GET https://%company%-api.fundapps.co/v1/ExPost/Result/fe633307-f196-4609-abfe-a1fc0111e875 HTTP/1.1
Content-Type: application/xml

(Response Headers, Rules running)
HTTP/1.1 202 Accepted
Content-Type: application/xml

(Response Content, Rules running)
<?xml version="1.0" encoding="utf-8"?>
<ResultsSnapshot ValidationState="Passed" RuleState="InProgress" />

(Response Headers, Validation failed)
HTTP/1.1 200 OK
Content-Type: application/xml

(Response Content, Validation failed)
<?xml version="1.0" encoding="utf-8"?>
<ResultSnapshot ValidationState="Failed" RuleState="NotRun" />

(Response Content, File processed successfully)
<?xml version="1.0" encoding="utf-8"?>
<ResultsSnapshot ValidationState="Passed" RuleState="Passed" Status="Okay" PipelineStage="Finished" Duration="00:01:28.7030000">
    <Summary DataDate="2015-07-20">
        <Breach Total="1" New="1" />
        <Disclosure Total="18" New="18" />
        <Unknown Total="2" New="2" />
        <Warning Total="4" New="4" />
        <OK Total="399" New="399" />
    </Summary>
</ResultsSnapshot>