Git Product home page Git Product logo

financialinstrument's People

Contributors

braverock avatar gsee avatar joshuaulrich avatar opentrades avatar peterccarl avatar ryogi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

financialinstrument's Issues

convert P&L in points to USD FinancialInstrument package

I have several currency pairs, not necessarily downloaded from online resources, it could be a regular file from disk, but for simplicity of the example and reproducibility I will download from the network.

library(quantmod)
getSymbols("AUD/CAD",src="oanda",from="2024-01-01")
getSymbols("CAD/CHF",src="oanda",from="2024-01-01")
getSymbols("USD/JPY",src="oanda",from="2024-01-01")

Now let’s calculate a simple “buy and hold” strategy in points

# buy and hold P&L in points
BH_AUDCAD <- AUDCAD - c(coredata(AUDCAD[1]))
BH_CADCHF <- CADCHF - c(coredata(CADCHF[1]))
BH_USDJPY <- USDJPY - c(coredata(USDJPY[1]))

Now I would like to calculate p&l in USD but I’m a little confused and don’t know how to do it correctly

library(FinancialInstrument)
currency(c("AUD", "CAD", "CHF", "USD", "JPY"))
stock(c("AUDCAD", "CADCHF", "USDJPY"), currency="USD")

PnL_USD_AUDCAD <-    ....
PnL_USD_CADCHF <-    ....
PnL_USD_USDJPY <-    ....

C stack usage is too close to the limit

Hello, I'm getting the following error when trying to run the command:
stock(data, currency = "USD")
Error: C stack usage 15923264 is too close to the limit

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.