Finance
fin returnsfin returnsfin varfin varfin backtest_varfin backtest_varfin performancefin performancefin drawdownfin betafin betafin portfoliofin portfoliofin frontierfin frontierfin npvfin irrfin irrfin amortizationfin amortizationfin bondfin bondfin black_scholesfin black_scholesfin implied_volfin implied_vol
fin returns <json_prices>
Description
Returns of a price series (simple)
Returns of a price series (simple)
Parameters
json_prices: The prices - String - required
json_prices: The prices - String - required
admin
fin returns "[100, 102, 99, 104]"
mentdb
{"type": "simple", "total_return": 0.040000000000000036, "returns": [0.020000000000000018, -0.02941176470588236, 0.05050505050505061]}
Complete: prices -> returns -> value at risk and performance
admin
-> "[prices]" "[100, 101.2, 100.5, 102.3, 101.8, 103.1, 102.2, 104.0, 103.5, 105.2, 104.1, 106.3, 105.0, 104.2, 106.8]"; json load "tuto_r" (fin returns [prices]); -> "[r]" (json select "tuto_r" "/returns"); json load "tuto_v" (fin var [r] "{\"method\": \"parametric\"}"); json load "tuto_p" (fin performance [r]); -> "[res]" (concat "1-day VaR 95 %: " (math round (* 100 (json select "tuto_v" "/var")) 2) " %, annual volatility " (math round (* 100 (json select "tuto_p" "/annual_volatility")) 1) " %, max drawdown " (math round (* 100 (json select "tuto_p" "/max_drawdown")) 2) " %"); json unload "tuto_r"; json unload "tuto_v"; json unload "tuto_p"; [res]
mentdb
1-day VaR 95 %: 1.78 %, annual volatility 21.8 %, max drawdown -1.98 %
fin returns <json_prices> <json_params>
Description
Returns with parameters: type (simple or log)
Returns with parameters: type (simple or log)
Parameters
json_prices: The prices - String - required
json_params: The parameters - String - required
json_prices: The prices - String - required
json_params: The parameters - String - required
admin
fin returns "[100, 102, 99, 104]" "{\"type\": \"log\"}"
mentdb
{"type": "log", "total_return": 0.040000000000000036, "returns": [0.01980262729617973, -0.02985296314968116, 0.049271049006782835]}
fin var <json_returns>
Description
Value at risk and expected shortfall (CVaR) at 95 % from the historical returns, as positive losses
Value at risk and expected shortfall (CVaR) at 95 % from the historical returns, as positive losses
Parameters
json_returns: The returns - String - required
json_returns: The returns - String - required
admin
fin var "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]"
mentdb
{"method": "historical", "level": 0.95, "horizon": 1, "observations": 120, "var": 0.013992999999999995, "expected_shortfall": 0.01954166666666667, "mean": 0.001198666666666667, "sd": 0.01089256750168258}
fin var <json_returns> <json_params>
Description
VaR with parameters: level (0.95), method (historical, parametric, cornish_fisher: corrected for the skewness and the kurtosis), horizon (periods, square root of time), value (of the portfolio)
VaR with parameters: level (0.95), method (historical, parametric, cornish_fisher: corrected for the skewness and the kurtosis), horizon (periods, square root of time), value (of the portfolio)
Parameters
json_returns: The returns - String - required
json_params: The parameters - String - required
json_returns: The returns - String - required
json_params: The parameters - String - required
admin
fin var "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]" "{\"level\": 0.99, \"method\": \"cornish_fisher\", \"horizon\": 10, \"value\": 1000000}"
mentdb
{"method": "cornish_fisher", "level": 0.99, "horizon": 10, "observations": 120, "var": 58089.296535481655, "expected_shortfall": 62882.977687199804, "mean": 0.001198666666666667, "sd": 0.01089256750168258}
Used in use cases (1 recipe)
Financial analyst › Portfolio: maximum Sharpe allocation, value at risk and its backtest
Financial analyst › Portfolio: maximum Sharpe allocation, value at risk and its backtest
fin backtest_var <json_returns> <var>
Description
Backtest of a VaR (one value or one per period): exceptions, Kupiec test (number), Christoffersen test (independence), conditional coverage, Basel zone at 99 %
Backtest of a VaR (one value or one per period): exceptions, Kupiec test (number), Christoffersen test (independence), conditional coverage, Basel zone at 99 %
Parameters
json_returns: The returns - String - required
var: The VaR (positive loss) or a JSON array of VaR - String - required
json_returns: The returns - String - required
var: The VaR (positive loss) or a JSON array of VaR - String - required
admin
fin backtest_var "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]" 0.022
mentdb
{"observations": 120, "exceptions": 2, "expected_exceptions": 1.200000000000001, "exception_rate": 0.016666666666666666, "kupiec_lr": 0.4487018338243196, "kupiec_p_value": 0.5029520782829524, "independence_lr": 0.06837939874164789, "independence_p_value": 0.7937111532088994, "conditional_coverage_p_value": 0.7721776674255983, "basel_zone": "yellow"}
fin backtest_var <json_returns> <var> <json_params>
Description
Backtest with parameters: level (0.99)
Backtest with parameters: level (0.99)
Parameters
json_returns: The returns - String - required
var: The VaR - String - required
json_params: The parameters - String - required
json_returns: The returns - String - required
var: The VaR - String - required
json_params: The parameters - String - required
admin
fin backtest_var "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]" 0.016 "{\"level\": 0.95}"
mentdb
{"observations": 120, "exceptions": 5, "expected_exceptions": 6.000000000000005, "exception_rate": 0.041666666666666664, "kupiec_lr": 0.18553082487402506, "kupiec_p_value": 0.6666625991331548, "independence_lr": 0.43873721860737547, "independence_p_value": 0.5077325766750485, "conditional_coverage_p_value": 0.7318834333633082}
Used in use cases (1 recipe)
Financial analyst › Portfolio: maximum Sharpe allocation, value at risk and its backtest
Financial analyst › Portfolio: maximum Sharpe allocation, value at risk and its backtest
fin performance <json_returns>
Description
Performance of a return series (daily by default): total and annual return, volatility, Sharpe, Sortino, max drawdown, Calmar, skewness, kurtosis, best, worst
Performance of a return series (daily by default): total and annual return, volatility, Sharpe, Sortino, max drawdown, Calmar, skewness, kurtosis, best, worst
Parameters
json_returns: The returns - String - required
json_returns: The returns - String - required
admin
fin performance "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]"
mentdb
{"periods": 120, "total_return": 0.14650935720044678, "annual_return": 0.3325790076796058, "annual_volatility": 0.17291414849061743, "sharpe": 1.7469015846114557, "sortino": 2.867378824353137, "max_drawdown": -0.0975460483498174, "calmar": 3.409456490609631, "skewness": 0.23026546303086656, "excess_kurtosis": -0.43913443202454383, "best": 0.02569, "worst": -0.02388, "positive_share": 0.525}
fin performance <json_returns> <json_params>
Description
Performance with parameters: rf (annual risk-free rate), periods_per_year (252, 52, 12), mar (minimum acceptable return for Sortino)
Performance with parameters: rf (annual risk-free rate), periods_per_year (252, 52, 12), mar (minimum acceptable return for Sortino)
Parameters
json_returns: The returns - String - required
json_params: The parameters - String - required
json_returns: The returns - String - required
json_params: The parameters - String - required
admin
fin performance "[0.012, -0.004, 0.021, 0.008, -0.015, 0.011, 0.006, 0.019, -0.002, 0.004, 0.013, -0.007]" "{\"periods_per_year\": 12, \"rf\": 0.02}"
mentdb
{"periods": 12, "total_return": 0.06735434876562363, "annual_return": 0.06735434876562363, "annual_volatility": 0.037411714256852274, "sharpe": 1.2295614064670848, "sortino": 3.8491981672307074, "max_drawdown": -0.014999999999999902, "calmar": 4.490289917708271, "skewness": -0.316753876709505, "excess_kurtosis": -1.1060974047170817, "best": 0.021, "worst": -0.015, "positive_share": 0.6666666666666666}
fin drawdown <json_prices>
Description
Drawdowns of a price (or wealth) series: maximum drawdown, peak, trough, recovery and duration, drawdown of each period
Drawdowns of a price (or wealth) series: maximum drawdown, peak, trough, recovery and duration, drawdown of each period
Parameters
json_prices: The prices - String - required
json_prices: The prices - String - required
admin
fin drawdown "[100, 110, 105, 90, 95, 112, 108]"
mentdb
{"max_drawdown": -0.18181818181818177, "peak_index": 1, "trough_index": 3, "recovery_index": 5, "duration": 4, "drawdowns": [0, 0, -0.045454545454545414, -0.18181818181818177, -0.13636363636363635, 0, -0.0357142857142857]}
fin beta <json_asset> <json_market>
Description
Beta of an asset against a market: alpha, beta, correlation, R2, tracking error, information ratio, Treynor
Beta of an asset against a market: alpha, beta, correlation, R2, tracking error, information ratio, Treynor
Parameters
json_asset: The asset returns - String - required
json_market: The market returns - String - required
json_asset: The asset returns - String - required
json_market: The market returns - String - required
admin
fin beta "[-0.02232, -0.01282, 0.00934, 0.00425, -0.00071, 0.00948, 0.03159, 0.00026, -0.00637, 0.00354, 0.00753, -0.00872, 0.03839, -0.00142, 0.00579, -0.00421, 0.00881, 0.01163, 0.01424, 0.00234, -0.02817, -0.01136, 0.00261, 0.0204, -0.00373, -0.02094, 0.02292, 0.02659, 0.01205, -0.02463, -0.00698, 0.01116, -0.05259, 0.0206, 0.00391, -0.0195, 0.0227, 0.00618, -0.03705, 0.00692, 0.02985, 0.0354, 0.00376, -0.01093, 0.00329, 0.03162, -0.00368, 0.00895, 0.01531, -0.01983, 0.01341, 0.0093, 0.03234, 0.0143, 0.02316, -0.01318, 0.01426, -0.02552, -0.01069, -0.01937, 0.03027, -0.01, -0.00872, -0.0136, -0.02352, 0.00348, 0.00192, 0.00528, -0.00081, -0.0022, 0.00506, -0.01343, 0.03394, -0.00193, 0.02661, -0.0033, -0.0074, 0.00119, -0.01629, -0.0131, 0.003, -0.00162, 0.01798, -0.02274, 0.00824, 0.01935, 0.00351, 0.01605, 0.00368, -0.00364, 0.02032, 0.00781, 0.00847, 0.01461, 0.00912, -0.01274, -0.0195, -0.00088, -0.00646, -0.00716, -0.01945, -0.03047, -0.00661, -0.01605, -0.02153, -0.0092, -0.00519, 0.03592, -0.01604, 0.01633, -0.00289, 0.01222, -0.00371, 0.01572, 0.01255, -0.00302, -0.00612, -0.01087, 0.03021, -0.00127]" "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]"
mentdb
{"beta": 0.5585225690426855, "alpha_annual": 0.24045443870469058, "correlation": 0.3602108203346441, "r2": 0.12975183508615723, "tracking_error": 0.2615031499079213, "information_ratio": 0.40955529613203967, "treynor": 0.7325827507764144}
fin beta <json_asset> <json_market> <json_params>
Description
Beta with parameters: rf, periods_per_year
Beta with parameters: rf, periods_per_year
Parameters
json_asset: The asset returns - String - required
json_market: The market returns - String - required
json_params: The parameters - String - required
json_asset: The asset returns - String - required
json_market: The market returns - String - required
json_params: The parameters - String - required
admin
fin beta "[-0.02232, -0.01282, 0.00934, 0.00425, -0.00071, 0.00948, 0.03159, 0.00026, -0.00637, 0.00354, 0.00753, -0.00872, 0.03839, -0.00142, 0.00579, -0.00421, 0.00881, 0.01163, 0.01424, 0.00234, -0.02817, -0.01136, 0.00261, 0.0204, -0.00373, -0.02094, 0.02292, 0.02659, 0.01205, -0.02463, -0.00698, 0.01116, -0.05259, 0.0206, 0.00391, -0.0195, 0.0227, 0.00618, -0.03705, 0.00692, 0.02985, 0.0354, 0.00376, -0.01093, 0.00329, 0.03162, -0.00368, 0.00895, 0.01531, -0.01983, 0.01341, 0.0093, 0.03234, 0.0143, 0.02316, -0.01318, 0.01426, -0.02552, -0.01069, -0.01937, 0.03027, -0.01, -0.00872, -0.0136, -0.02352, 0.00348, 0.00192, 0.00528, -0.00081, -0.0022, 0.00506, -0.01343, 0.03394, -0.00193, 0.02661, -0.0033, -0.0074, 0.00119, -0.01629, -0.0131, 0.003, -0.00162, 0.01798, -0.02274, 0.00824, 0.01935, 0.00351, 0.01605, 0.00368, -0.00364, 0.02032, 0.00781, 0.00847, 0.01461, 0.00912, -0.01274, -0.0195, -0.00088, -0.00646, -0.00716, -0.01945, -0.03047, -0.00661, -0.01605, -0.02153, -0.0092, -0.00519, 0.03592, -0.01604, 0.01633, -0.00289, 0.01222, -0.00371, 0.01572, 0.01255, -0.00302, -0.00612, -0.01087, 0.03021, -0.00127]" "[-0.01139, -0.02254, 0.01141, -0.00464, -0.00698, -0.00315, -0.0037, -0.00547, -0.00345, 0.00063, 0.02057, 0.02515, 0.00707, -0.02388, -0.00347, 0.00331, 0.01545, 0.00773, -0.0042, -0.00289, 0.00038, 0.00239, 0.00349, 0.02301, 0.02197, 0.00816, 0.01333, -0.01855, 0.00807, -0.01395, -0.00791, 0.00611, -0.01222, 0.00308, -0.00571, -0.01002, 0.02131, 0.00278, -0.00241, -0.01247, 0.01182, 0.01095, 0.01127, 0.0016, -0.00423, 0.02124, -0.00869, 0.00464, -0.01091, -0.01481, -0.00981, 0.01172, -0.00616, -0.01025, 0.00034, 0.00465, -0.00789, -0.01831, 0.01085, -0.00334, 0.00997, -0.00397, -0.00036, -0.01255, -0.0119, -0.0117, -0.01311, 0.01533, -0.00665, 0.00219, 0.00134, 0.00251, 0.00205, 0.00044, 0.01455, 0.00233, -0.00834, -0.01187, 0.00593, 0.00445, 0.02569, -0.00547, 0.01046, -0.00325, -0.00716, 0.00861, 0.02188, -0.00399, -0.00716, -0.00075, 0.01045, 0.0033, 0.01269, 0.02354, -0.00024, -0.00018, -0.00795, -0.00461, -0.00845, 0.01216, -2e-05, 0.00213, 0.00997, 0.00199, -0.00327, 0.0029, 0.00435, 0.01843, -0.00323, 0.01737, -0.01211, 0.00053, 0.00183, 0.01876, 0.01621, -0.00438, 0.00425, -0.01916, -0.0055, 0.0115]" "{\"rf\": 0.02}"
mentdb
{"beta": 0.5585225690426855, "alpha_annual": 0.23162489008554432, "correlation": 0.3602108203346441, "r2": 0.12975183508615723, "tracking_error": 0.2615031499079213, "information_ratio": 0.40955529613203967, "treynor": 0.6967739919033751}
fin portfolio <json_returns>
Description
Markowitz portfolio of maximum Sharpe ratio without short selling, from the returns (one row per period, one column per asset): weights, annual return and volatility
Markowitz portfolio of maximum Sharpe ratio without short selling, from the returns (one row per period, one column per asset): weights, annual return and volatility
Parameters
json_returns: The returns - String - required
json_returns: The returns - String - required
admin
fin portfolio "[[-0.01139, -0.02232, 0.00355], [-0.02254, -0.01282, -0.01108], [0.01141, 0.00934, 0.00698], [-0.00464, 0.00425, -0.00123], [-0.00698, -0.00071, -0.00609], [-0.00315, 0.00948, 0.00049], [-0.0037, 0.03159, 0.00049], [-0.00547, 0.00026, -0.00241], [-0.00345, -0.00637, 0.01033], [0.00063, 0.00354, 0.00357], [0.02057, 0.00753, -0.00292], [0.02515, -0.00872, -0.00164], [0.00707, 0.03839, -0.00455], [-0.02388, -0.00142, -0.00241], [-0.00347, 0.00579, 0.00132], [0.00331, -0.00421, 0.00665], [0.01545, 0.00881, -0.00206], [0.00773, 0.01163, -0.005], [-0.0042, 0.01424, -0.00028], [-0.00289, 0.00234, 3e-05], [0.00038, -0.02817, 0.00895], [0.00239, -0.01136, 0.0051], [0.00349, 0.00261, 0.00544], [0.02301, 0.0204, 0.00813], [0.02197, -0.00373, -0.00242], [0.00816, -0.02094, -0.00114], [0.01333, 0.02292, 0.0031], [-0.01855, 0.02659, 0.00295], [0.00807, 0.01205, -0.00838], [-0.01395, -0.02463, 0.00979], [-0.00791, -0.00698, -0.00107], [0.00611, 0.01116, 0.00154], [-0.01222, -0.05259, 0.00103], [0.00308, 0.0206, -0.00032], [-0.00571, 0.00391, -0.00757], [-0.01002, -0.0195, 0.00164], [0.02131, 0.0227, 0.00591], [0.00278, 0.00618, -0.00205], [-0.00241, -0.03705, -0.00581], [-0.01247, 0.00692, 0.00352], [0.01182, 0.02985, -0.00133], [0.01095, 0.0354, 0.00016], [0.01127, 0.00376, -0.00786], [0.0016, -0.01093, 0.00074], [-0.00423, 0.00329, -0.01049], [0.02124, 0.03162, -0.00155], [-0.00869, -0.00368, 0.00358], [0.00464, 0.00895, -0.00965], [-0.01091, 0.01531, 0.0014], [-0.01481, -0.01983, -0.00704], [-0.00981, 0.01341, -0.00091], [0.01172, 0.0093, -0.0074], [-0.00616, 0.03234, -0.00368], [-0.01025, 0.0143, 0.00066], [0.00034, 0.02316, -0.00876], [0.00465, -0.01318, -0.00695], [-0.00789, 0.01426, -0.00052], [-0.01831, -0.02552, 0.00798], [0.01085, -0.01069, 0.01258], [-0.00334, -0.01937, -0.0005], [0.00997, 0.03027, 0.00546], [-0.00397, -0.01, -0.00724], [-0.00036, -0.00872, 0.00145], [-0.01255, -0.0136, -0.00431], [-0.0119, -0.02352, -0.00501], [-0.0117, 0.00348, 0.00071], [-0.01311, 0.00192, 0.00167], [0.01533, 0.00528, -0.00087], [-0.00665, -0.00081, 0.00272], [0.00219, -0.0022, 0.00309], [0.00134, 0.00506, -0.00458], [0.00251, -0.01343, -0.00411], [0.00205, 0.03394, 0.0053], [0.00044, -0.00193, 0.00525], [0.01455, 0.02661, -0.00075], [0.00233, -0.0033, -0.00126], [-0.00834, -0.0074, -0.01081], [-0.01187, 0.00119, -0.00454], [0.00593, -0.01629, -0.00169], [0.00445, -0.0131, -0.00345], [0.02569, 0.003, -0.00341], [-0.00547, -0.00162, 6e-05], [0.01046, 0.01798, -0.00186], [-0.00325, -0.02274, -0.00745], [-0.00716, 0.00824, 0.00081], [0.00861, 0.01935, -0.00064], [0.02188, 0.00351, -0.003], [-0.00399, 0.01605, -0.0005], [-0.00716, 0.00368, 0.00599], [-0.00075, -0.00364, 0.00574], [0.01045, 0.02032, -0.0037], [0.0033, 0.00781, -0.00898], [0.01269, 0.00847, -0.00154], [0.02354, 0.01461, -0.00348], [-0.00024, 0.00912, 0.00436], [-0.00018, -0.01274, -0.00336], [-0.00795, -0.0195, 0.0001], [-0.00461, -0.00088, -0.00402], [-0.00845, -0.00646, -0.00158], [0.01216, -0.00716, 0.00125], [-2e-05, -0.01945, 0.00391], [0.00213, -0.03047, 0.00327], [0.00997, -0.00661, 0.00884], [0.00199, -0.01605, 0.00307], [-0.00327, -0.02153, -0.01074], [0.0029, -0.0092, 0.00349], [0.00435, -0.00519, -0.00251], [0.01843, 0.03592, 0.00404], [-0.00323, -0.01604, -0.00177], [0.01737, 0.01633, -0.00128], [-0.01211, -0.00289, -0.00428], [0.00053, 0.01222, 0.00566], [0.00183, -0.00371, 0.00136], [0.01876, 0.01572, -0.00693], [0.01621, 0.01255, 0.01793], [-0.00438, -0.00302, -0.00131], [0.00425, -0.00612, -0.00731], [-0.01916, -0.01087, -0.00241], [-0.0055, 0.03021, 0.00425], [0.0115, -0.00127, 0.00173]]"
mentdb
{"objective": "max_sharpe", "weights": {"asset0": 0.6742449594007229, "asset1": 0.325755040599277, "asset2": 0}, "annual_return": 0.3369523648481827, "annual_volatility": 0.16898551843504378, "sharpe": 1.993971838348406, "asset_returns": [0.30206400000000005, 0.40916400000000025, -0.09792300000000001]}
fin portfolio <json_returns> <json_params>
Description
Portfolio with parameters: objective (max_sharpe, min_variance, target_return), target (annual return), rf, long_only (true), names, periods_per_year
Portfolio with parameters: objective (max_sharpe, min_variance, target_return), target (annual return), rf, long_only (true), names, periods_per_year
Parameters
json_returns: The returns - String - required
json_params: The parameters - String - required
json_returns: The returns - String - required
json_params: The parameters - String - required
admin
fin portfolio "[[-0.01139, -0.02232, 0.00355], [-0.02254, -0.01282, -0.01108], [0.01141, 0.00934, 0.00698], [-0.00464, 0.00425, -0.00123], [-0.00698, -0.00071, -0.00609], [-0.00315, 0.00948, 0.00049], [-0.0037, 0.03159, 0.00049], [-0.00547, 0.00026, -0.00241], [-0.00345, -0.00637, 0.01033], [0.00063, 0.00354, 0.00357], [0.02057, 0.00753, -0.00292], [0.02515, -0.00872, -0.00164], [0.00707, 0.03839, -0.00455], [-0.02388, -0.00142, -0.00241], [-0.00347, 0.00579, 0.00132], [0.00331, -0.00421, 0.00665], [0.01545, 0.00881, -0.00206], [0.00773, 0.01163, -0.005], [-0.0042, 0.01424, -0.00028], [-0.00289, 0.00234, 3e-05], [0.00038, -0.02817, 0.00895], [0.00239, -0.01136, 0.0051], [0.00349, 0.00261, 0.00544], [0.02301, 0.0204, 0.00813], [0.02197, -0.00373, -0.00242], [0.00816, -0.02094, -0.00114], [0.01333, 0.02292, 0.0031], [-0.01855, 0.02659, 0.00295], [0.00807, 0.01205, -0.00838], [-0.01395, -0.02463, 0.00979], [-0.00791, -0.00698, -0.00107], [0.00611, 0.01116, 0.00154], [-0.01222, -0.05259, 0.00103], [0.00308, 0.0206, -0.00032], [-0.00571, 0.00391, -0.00757], [-0.01002, -0.0195, 0.00164], [0.02131, 0.0227, 0.00591], [0.00278, 0.00618, -0.00205], [-0.00241, -0.03705, -0.00581], [-0.01247, 0.00692, 0.00352], [0.01182, 0.02985, -0.00133], [0.01095, 0.0354, 0.00016], [0.01127, 0.00376, -0.00786], [0.0016, -0.01093, 0.00074], [-0.00423, 0.00329, -0.01049], [0.02124, 0.03162, -0.00155], [-0.00869, -0.00368, 0.00358], [0.00464, 0.00895, -0.00965], [-0.01091, 0.01531, 0.0014], [-0.01481, -0.01983, -0.00704], [-0.00981, 0.01341, -0.00091], [0.01172, 0.0093, -0.0074], [-0.00616, 0.03234, -0.00368], [-0.01025, 0.0143, 0.00066], [0.00034, 0.02316, -0.00876], [0.00465, -0.01318, -0.00695], [-0.00789, 0.01426, -0.00052], [-0.01831, -0.02552, 0.00798], [0.01085, -0.01069, 0.01258], [-0.00334, -0.01937, -0.0005], [0.00997, 0.03027, 0.00546], [-0.00397, -0.01, -0.00724], [-0.00036, -0.00872, 0.00145], [-0.01255, -0.0136, -0.00431], [-0.0119, -0.02352, -0.00501], [-0.0117, 0.00348, 0.00071], [-0.01311, 0.00192, 0.00167], [0.01533, 0.00528, -0.00087], [-0.00665, -0.00081, 0.00272], [0.00219, -0.0022, 0.00309], [0.00134, 0.00506, -0.00458], [0.00251, -0.01343, -0.00411], [0.00205, 0.03394, 0.0053], [0.00044, -0.00193, 0.00525], [0.01455, 0.02661, -0.00075], [0.00233, -0.0033, -0.00126], [-0.00834, -0.0074, -0.01081], [-0.01187, 0.00119, -0.00454], [0.00593, -0.01629, -0.00169], [0.00445, -0.0131, -0.00345], [0.02569, 0.003, -0.00341], [-0.00547, -0.00162, 6e-05], [0.01046, 0.01798, -0.00186], [-0.00325, -0.02274, -0.00745], [-0.00716, 0.00824, 0.00081], [0.00861, 0.01935, -0.00064], [0.02188, 0.00351, -0.003], [-0.00399, 0.01605, -0.0005], [-0.00716, 0.00368, 0.00599], [-0.00075, -0.00364, 0.00574], [0.01045, 0.02032, -0.0037], [0.0033, 0.00781, -0.00898], [0.01269, 0.00847, -0.00154], [0.02354, 0.01461, -0.00348], [-0.00024, 0.00912, 0.00436], [-0.00018, -0.01274, -0.00336], [-0.00795, -0.0195, 0.0001], [-0.00461, -0.00088, -0.00402], [-0.00845, -0.00646, -0.00158], [0.01216, -0.00716, 0.00125], [-2e-05, -0.01945, 0.00391], [0.00213, -0.03047, 0.00327], [0.00997, -0.00661, 0.00884], [0.00199, -0.01605, 0.00307], [-0.00327, -0.02153, -0.01074], [0.0029, -0.0092, 0.00349], [0.00435, -0.00519, -0.00251], [0.01843, 0.03592, 0.00404], [-0.00323, -0.01604, -0.00177], [0.01737, 0.01633, -0.00128], [-0.01211, -0.00289, -0.00428], [0.00053, 0.01222, 0.00566], [0.00183, -0.00371, 0.00136], [0.01876, 0.01572, -0.00693], [0.01621, 0.01255, 0.01793], [-0.00438, -0.00302, -0.00131], [0.00425, -0.00612, -0.00731], [-0.01916, -0.01087, -0.00241], [-0.0055, 0.03021, 0.00425], [0.0115, -0.00127, 0.00173]]" "{\"objective\": \"min_variance\", \"names\": [\"equity\", \"tech\", \"bonds\"]}"
mentdb
{"objective": "min_variance", "weights": {"equity": 0.14289926728990926, "tech": 0.03910339791862129, "bonds": 0.8179973347914694}, "annual_return": -0.020936326034151145, "annual_volatility": 0.07575323848317041, "sharpe": -0.27637532669712106, "asset_returns": [0.30206400000000005, 0.40916400000000025, -0.09792300000000001]}
Used in use cases (1 recipe)
Financial analyst › Portfolio: maximum Sharpe allocation, value at risk and its backtest
Financial analyst › Portfolio: maximum Sharpe allocation, value at risk and its backtest
fin frontier <json_returns>
Description
Efficient frontier: portfolios from the minimum variance to the highest return, and the point of best Sharpe ratio
Efficient frontier: portfolios from the minimum variance to the highest return, and the point of best Sharpe ratio
Parameters
json_returns: The returns - String - required
json_returns: The returns - String - required
admin
fin frontier "[[-0.01139, -0.02232, 0.00355], [-0.02254, -0.01282, -0.01108], [0.01141, 0.00934, 0.00698], [-0.00464, 0.00425, -0.00123], [-0.00698, -0.00071, -0.00609], [-0.00315, 0.00948, 0.00049], [-0.0037, 0.03159, 0.00049], [-0.00547, 0.00026, -0.00241], [-0.00345, -0.00637, 0.01033], [0.00063, 0.00354, 0.00357], [0.02057, 0.00753, -0.00292], [0.02515, -0.00872, -0.00164], [0.00707, 0.03839, -0.00455], [-0.02388, -0.00142, -0.00241], [-0.00347, 0.00579, 0.00132], [0.00331, -0.00421, 0.00665], [0.01545, 0.00881, -0.00206], [0.00773, 0.01163, -0.005], [-0.0042, 0.01424, -0.00028], [-0.00289, 0.00234, 3e-05], [0.00038, -0.02817, 0.00895], [0.00239, -0.01136, 0.0051], [0.00349, 0.00261, 0.00544], [0.02301, 0.0204, 0.00813], [0.02197, -0.00373, -0.00242], [0.00816, -0.02094, -0.00114], [0.01333, 0.02292, 0.0031], [-0.01855, 0.02659, 0.00295], [0.00807, 0.01205, -0.00838], [-0.01395, -0.02463, 0.00979], [-0.00791, -0.00698, -0.00107], [0.00611, 0.01116, 0.00154], [-0.01222, -0.05259, 0.00103], [0.00308, 0.0206, -0.00032], [-0.00571, 0.00391, -0.00757], [-0.01002, -0.0195, 0.00164], [0.02131, 0.0227, 0.00591], [0.00278, 0.00618, -0.00205], [-0.00241, -0.03705, -0.00581], [-0.01247, 0.00692, 0.00352], [0.01182, 0.02985, -0.00133], [0.01095, 0.0354, 0.00016], [0.01127, 0.00376, -0.00786], [0.0016, -0.01093, 0.00074], [-0.00423, 0.00329, -0.01049], [0.02124, 0.03162, -0.00155], [-0.00869, -0.00368, 0.00358], [0.00464, 0.00895, -0.00965], [-0.01091, 0.01531, 0.0014], [-0.01481, -0.01983, -0.00704], [-0.00981, 0.01341, -0.00091], [0.01172, 0.0093, -0.0074], [-0.00616, 0.03234, -0.00368], [-0.01025, 0.0143, 0.00066], [0.00034, 0.02316, -0.00876], [0.00465, -0.01318, -0.00695], [-0.00789, 0.01426, -0.00052], [-0.01831, -0.02552, 0.00798], [0.01085, -0.01069, 0.01258], [-0.00334, -0.01937, -0.0005], [0.00997, 0.03027, 0.00546], [-0.00397, -0.01, -0.00724], [-0.00036, -0.00872, 0.00145], [-0.01255, -0.0136, -0.00431], [-0.0119, -0.02352, -0.00501], [-0.0117, 0.00348, 0.00071], [-0.01311, 0.00192, 0.00167], [0.01533, 0.00528, -0.00087], [-0.00665, -0.00081, 0.00272], [0.00219, -0.0022, 0.00309], [0.00134, 0.00506, -0.00458], [0.00251, -0.01343, -0.00411], [0.00205, 0.03394, 0.0053], [0.00044, -0.00193, 0.00525], [0.01455, 0.02661, -0.00075], [0.00233, -0.0033, -0.00126], [-0.00834, -0.0074, -0.01081], [-0.01187, 0.00119, -0.00454], [0.00593, -0.01629, -0.00169], [0.00445, -0.0131, -0.00345], [0.02569, 0.003, -0.00341], [-0.00547, -0.00162, 6e-05], [0.01046, 0.01798, -0.00186], [-0.00325, -0.02274, -0.00745], [-0.00716, 0.00824, 0.00081], [0.00861, 0.01935, -0.00064], [0.02188, 0.00351, -0.003], [-0.00399, 0.01605, -0.0005], [-0.00716, 0.00368, 0.00599], [-0.00075, -0.00364, 0.00574], [0.01045, 0.02032, -0.0037], [0.0033, 0.00781, -0.00898], [0.01269, 0.00847, -0.00154], [0.02354, 0.01461, -0.00348], [-0.00024, 0.00912, 0.00436], [-0.00018, -0.01274, -0.00336], [-0.00795, -0.0195, 0.0001], [-0.00461, -0.00088, -0.00402], [-0.00845, -0.00646, -0.00158], [0.01216, -0.00716, 0.00125], [-2e-05, -0.01945, 0.00391], [0.00213, -0.03047, 0.00327], [0.00997, -0.00661, 0.00884], [0.00199, -0.01605, 0.00307], [-0.00327, -0.02153, -0.01074], [0.0029, -0.0092, 0.00349], [0.00435, -0.00519, -0.00251], [0.01843, 0.03592, 0.00404], [-0.00323, -0.01604, -0.00177], [0.01737, 0.01633, -0.00128], [-0.01211, -0.00289, -0.00428], [0.00053, 0.01222, 0.00566], [0.00183, -0.00371, 0.00136], [0.01876, 0.01572, -0.00693], [0.01621, 0.01255, 0.01793], [-0.00438, -0.00302, -0.00131], [0.00425, -0.00612, -0.00731], [-0.01916, -0.01087, -0.00241], [-0.0055, 0.03021, 0.00425], [0.0115, -0.00127, 0.00173]]"
mentdb
{"points": [{"annual_return": -0.020936326034151145, "annual_volatility": 0.07575323848317041, "sharpe": -0.27637532669712106, "weights": {"asset0": 0.14289926728990926, "asset1": 0.03910339791862129, "asset2": 0.8179973347914694}}, {"annual_return": 0.0017005332308041854, "annual_volatility": 0.07635134753406968, "sharpe": 0.022272471747081732, "weights": {"asset0": 0.17904332023512481, "asset1": 0.0552341761865662, "asset2": 0.765722503578309}}, {"annual_return": 0.02433739249575953, "annual_volatility": 0.0781182031219925, "sharpe": 0.3115457284360892, "weights": {"asset0": 0.21518737318526301, "asset1": 0.07136495445062821, "asset2": 0.7134476723641088}}, {"annual_return": 0.046974251760714875, "annual_volatility": 0.08097733823058065, "sharpe": 0.5800913290945306, "weights": {"asset0": 0.2513314261354014, "asset1": 0.08749573271469008, "asset2": 0.6611728411499085}}, {"annual_return": 0.06961111102567016, "annual_volatility": 0.08481836601804608, "sharpe": 0.8207079939604071, "weights": {"asset0": 0.2874754790855396, "asset1": 0.103626510978752, "asset2": 0.6088980099357084}}, {"annual_return": 0.09224797029062551, "annual_volatility": 0.089514978524228, "sharpe": 1.030531111233611, "weights": {"asset0": 0.32361953204682636, "asset1": 0.11975728923402007, "asset2": 0.5566231787191536}}, {"annual_return": 0.11488482955558081, "annual_volatility": 0.09494028547237027, "sharpe": 1.2100746167338505, "weights": {"asset0": 0.35976358499820976, "asset1": 0.1358880674970998, "asset2": 0.5043483475046905}}, {"annual_return": 0.13752168882053617, "annual_volatility": 0.10097690077496792, "sharpe": 1.3619123558467114, "weights": {"asset0": 0.39590763794959316, "asset1": 0.15201884576017963, "asset2": 0.4520735162902272}}, {"annual_return": 0.16015854808549154, "annual_volatility": 0.10752191141260771, "sharpe": 1.4895433496424229, "weights": {"asset0": 0.43205169090097656, "asset1": 0.1681496240232594, "asset2": 0.39979868507576405}}, {"annual_return": 0.1827954073504468, "annual_volatility": 0.11448815937329063, "sharpe": 1.5966315499442978, "weights": {"asset0": 0.4681957438523599, "asset1": 0.18428040228633913, "asset2": 0.34752385386130097}}, {"annual_return": 0.20543226661540223, "annual_volatility": 0.12180339116259341, "sharpe": 1.6865890567954218, "weights": {"asset0": 0.5043397968037434, "asset1": 0.200411180549419, "asset2": 0.2952490226468376}}, {"annual_return": 0.22806912588035747, "annual_volatility": 0.12940843797794582, "sharpe": 1.762397641483206, "weights": {"asset0": 0.5404838497551268, "asset1": 0.2165419588124986, "asset2": 0.24297419143237456}}, {"annual_return": 0.2507059851453129, "annual_volatility": 0.13725513396677147, "sharpe": 1.8265690899839644, "weights": {"asset0": 0.5766279027065103, "asset1": 0.2326727370755785, "asset2": 0.19069936021791123}}, {"annual_return": 0.2733428444102682, "annual_volatility": 0.14530433592890915, "sharpe": 1.8811747265683971, "weights": {"asset0": 0.6127719556578937, "asset1": 0.24880351533865822, "asset2": 0.1384245290034481}}, {"annual_return": 0.29597970367522364, "annual_volatility": 0.1535241952866277, "sharpe": 1.9279026548397362, "weights": {"asset0": 0.6489160086092772, "asset1": 0.2649342936017381, "asset2": 0.08614969778898474}}, {"annual_return": 0.31861656294017887, "annual_volatility": 0.16188871886648643, "sharpe": 1.968120849748337, "weights": {"asset0": 0.6850600615606605, "asset1": 0.28106507186481783, "asset2": 0.03387486657452177}}, {"annual_return": 0.34125342220513416, "annual_volatility": 0.1714508863246916, "sharpe": 1.99038587388153, "weights": {"asset0": 0.6340856936962275, "asset1": 0.36591430630377253, "asset2": 0}}, {"annual_return": 0.3638902814700895, "annual_volatility": 0.19351524112978216, "sharpe": 1.8804218176595417, "weights": {"asset0": 0.4227237957974845, "asset1": 0.5772762042025155, "asset2": 0}}, {"annual_return": 0.38652714073504485, "annual_volatility": 0.22718018154291753, "sharpe": 1.7014122363575295, "weights": {"asset0": 0.21136189789874302, "asset1": 0.788638102101257, "asset2": 0}}, {"annual_return": 0.40916400000000025, "annual_volatility": 0.26811092001369174, "sharpe": 1.5260997201423399, "weights": {"asset0": 0, "asset1": 1, "asset2": 0}}], "best_sharpe_point": {"annual_return": 0.34125342220513416, "annual_volatility": 0.1714508863246916, "sharpe": 1.99038587388153, "weights": {"asset0": 0.6340856936962275, "asset1": 0.36591430630377253, "asset2": 0}}}
fin frontier <json_returns> <json_params>
Description
Frontier with parameters: points (20), rf, long_only, names, periods_per_year
Frontier with parameters: points (20), rf, long_only, names, periods_per_year
Parameters
json_returns: The returns - String - required
json_params: The parameters - String - required
json_returns: The returns - String - required
json_params: The parameters - String - required
admin
fin frontier "[[-0.01139, -0.02232, 0.00355], [-0.02254, -0.01282, -0.01108], [0.01141, 0.00934, 0.00698], [-0.00464, 0.00425, -0.00123], [-0.00698, -0.00071, -0.00609], [-0.00315, 0.00948, 0.00049], [-0.0037, 0.03159, 0.00049], [-0.00547, 0.00026, -0.00241], [-0.00345, -0.00637, 0.01033], [0.00063, 0.00354, 0.00357], [0.02057, 0.00753, -0.00292], [0.02515, -0.00872, -0.00164], [0.00707, 0.03839, -0.00455], [-0.02388, -0.00142, -0.00241], [-0.00347, 0.00579, 0.00132], [0.00331, -0.00421, 0.00665], [0.01545, 0.00881, -0.00206], [0.00773, 0.01163, -0.005], [-0.0042, 0.01424, -0.00028], [-0.00289, 0.00234, 3e-05], [0.00038, -0.02817, 0.00895], [0.00239, -0.01136, 0.0051], [0.00349, 0.00261, 0.00544], [0.02301, 0.0204, 0.00813], [0.02197, -0.00373, -0.00242], [0.00816, -0.02094, -0.00114], [0.01333, 0.02292, 0.0031], [-0.01855, 0.02659, 0.00295], [0.00807, 0.01205, -0.00838], [-0.01395, -0.02463, 0.00979], [-0.00791, -0.00698, -0.00107], [0.00611, 0.01116, 0.00154], [-0.01222, -0.05259, 0.00103], [0.00308, 0.0206, -0.00032], [-0.00571, 0.00391, -0.00757], [-0.01002, -0.0195, 0.00164], [0.02131, 0.0227, 0.00591], [0.00278, 0.00618, -0.00205], [-0.00241, -0.03705, -0.00581], [-0.01247, 0.00692, 0.00352], [0.01182, 0.02985, -0.00133], [0.01095, 0.0354, 0.00016], [0.01127, 0.00376, -0.00786], [0.0016, -0.01093, 0.00074], [-0.00423, 0.00329, -0.01049], [0.02124, 0.03162, -0.00155], [-0.00869, -0.00368, 0.00358], [0.00464, 0.00895, -0.00965], [-0.01091, 0.01531, 0.0014], [-0.01481, -0.01983, -0.00704], [-0.00981, 0.01341, -0.00091], [0.01172, 0.0093, -0.0074], [-0.00616, 0.03234, -0.00368], [-0.01025, 0.0143, 0.00066], [0.00034, 0.02316, -0.00876], [0.00465, -0.01318, -0.00695], [-0.00789, 0.01426, -0.00052], [-0.01831, -0.02552, 0.00798], [0.01085, -0.01069, 0.01258], [-0.00334, -0.01937, -0.0005], [0.00997, 0.03027, 0.00546], [-0.00397, -0.01, -0.00724], [-0.00036, -0.00872, 0.00145], [-0.01255, -0.0136, -0.00431], [-0.0119, -0.02352, -0.00501], [-0.0117, 0.00348, 0.00071], [-0.01311, 0.00192, 0.00167], [0.01533, 0.00528, -0.00087], [-0.00665, -0.00081, 0.00272], [0.00219, -0.0022, 0.00309], [0.00134, 0.00506, -0.00458], [0.00251, -0.01343, -0.00411], [0.00205, 0.03394, 0.0053], [0.00044, -0.00193, 0.00525], [0.01455, 0.02661, -0.00075], [0.00233, -0.0033, -0.00126], [-0.00834, -0.0074, -0.01081], [-0.01187, 0.00119, -0.00454], [0.00593, -0.01629, -0.00169], [0.00445, -0.0131, -0.00345], [0.02569, 0.003, -0.00341], [-0.00547, -0.00162, 6e-05], [0.01046, 0.01798, -0.00186], [-0.00325, -0.02274, -0.00745], [-0.00716, 0.00824, 0.00081], [0.00861, 0.01935, -0.00064], [0.02188, 0.00351, -0.003], [-0.00399, 0.01605, -0.0005], [-0.00716, 0.00368, 0.00599], [-0.00075, -0.00364, 0.00574], [0.01045, 0.02032, -0.0037], [0.0033, 0.00781, -0.00898], [0.01269, 0.00847, -0.00154], [0.02354, 0.01461, -0.00348], [-0.00024, 0.00912, 0.00436], [-0.00018, -0.01274, -0.00336], [-0.00795, -0.0195, 0.0001], [-0.00461, -0.00088, -0.00402], [-0.00845, -0.00646, -0.00158], [0.01216, -0.00716, 0.00125], [-2e-05, -0.01945, 0.00391], [0.00213, -0.03047, 0.00327], [0.00997, -0.00661, 0.00884], [0.00199, -0.01605, 0.00307], [-0.00327, -0.02153, -0.01074], [0.0029, -0.0092, 0.00349], [0.00435, -0.00519, -0.00251], [0.01843, 0.03592, 0.00404], [-0.00323, -0.01604, -0.00177], [0.01737, 0.01633, -0.00128], [-0.01211, -0.00289, -0.00428], [0.00053, 0.01222, 0.00566], [0.00183, -0.00371, 0.00136], [0.01876, 0.01572, -0.00693], [0.01621, 0.01255, 0.01793], [-0.00438, -0.00302, -0.00131], [0.00425, -0.00612, -0.00731], [-0.01916, -0.01087, -0.00241], [-0.0055, 0.03021, 0.00425], [0.0115, -0.00127, 0.00173]]" "{\"points\": 4}"
mentdb
{"points": [{"annual_return": -0.020936326034151145, "annual_volatility": 0.07575323848317041, "sharpe": -0.27637532669712106, "weights": {"asset0": 0.14289926728990926, "asset1": 0.03910339791862129, "asset2": 0.8179973347914694}}, {"annual_return": 0.12243044931056597, "annual_volatility": 0.09688997198692485, "sharpe": 1.2636028971820505, "weights": {"asset0": 0.3718116026486708, "asset1": 0.1412649935847932, "asset2": 0.48692340376653603}}, {"annual_return": 0.26579722465528305, "annual_volatility": 0.14260086698349364, "sharpe": 1.863924324429596, "weights": {"asset0": 0.6007239380074326, "asset1": 0.24342658925096491, "asset2": 0.15584947274160252}}, {"annual_return": 0.40916400000000025, "annual_volatility": 0.26811092001369174, "sharpe": 1.5260997201423399, "weights": {"asset0": 0, "asset1": 1, "asset2": 0}}], "best_sharpe_point": {"annual_return": 0.26579722465528305, "annual_volatility": 0.14260086698349364, "sharpe": 1.863924324429596, "weights": {"asset0": 0.6007239380074326, "asset1": 0.24342658925096491, "asset2": 0.15584947274160252}}}
fin npv <rate> <json_flows>
Description
Net present value of cash flows (the first flow at time 0), profitability index, simple and discounted payback periods
Net present value of cash flows (the first flow at time 0), profitability index, simple and discounted payback periods
Parameters
rate: The discount rate per period - Number - required
json_flows: The cash flows - String - required
rate: The discount rate per period - Number - required
json_flows: The cash flows - String - required
admin
fin npv 0.08 "[-1000, 300, 400, 500, 200]"
mentdb
{"npv": 164.6353969678665, "rate": 0.08, "periods": 4, "profitability_index": 1.1646353969678664, "payback_period": 3, "discounted_payback_period": 3}
fin irr <json_flows>
Description
Internal rate of return (one period between the flows)
Internal rate of return (one period between the flows)
Parameters
json_flows: The cash flows - String - required
json_flows: The cash flows - String - required
admin
fin irr "[-1000, 300, 400, 500, 200]"
mentdb
{"irr": 0.15322137877181546, "method": "IRR (one period between the flows)"}
fin irr <json_flows> <json_params>
Description
IRR with parameters: dates (XIRR: one date per flow, actual days / 365), guess
IRR with parameters: dates (XIRR: one date per flow, actual days / 365), guess
Parameters
json_flows: The cash flows - String - required
json_params: The parameters - String - required
json_flows: The cash flows - String - required
json_params: The parameters - String - required
admin
fin irr "[-10000, 2750, 4250, 3250, 2750]" "{\"dates\": [\"2008-01-01\", \"2008-03-01\", \"2008-10-30\", \"2009-02-15\", \"2009-04-01\"]}"
mentdb
{"irr": 0.3733625335188316, "method": "XIRR (actual days \/ 365)"}
fin amortization <principal> <annual_rate> <years>
Description
Loan schedule (constant payments, monthly): payment, total interest, schedule of each period
Loan schedule (constant payments, monthly): payment, total interest, schedule of each period
Parameters
principal: The principal - Number - required
annual_rate: The annual rate - Number - required
years: The duration in years - Number - required
principal: The principal - Number - required
annual_rate: The annual rate - Number - required
years: The duration in years - Number - required
admin
fin amortization 10000 0.05 1
mentdb
{"type": "annuity", "periods": 12, "rate_per_period": 0.004166666666666667, "payment": 856.0748178846737, "total_interest": 272.89781461605304, "total_paid": 10272.897814616053, "schedule": [{"period": 1, "payment": 856.0748178846737, "interest": 41.666666666666664, "principal": 814.4081512180071, "balance": 9185.591848781993}, {"period": 2, "payment": 856.0748178846737, "interest": 38.27329936992497, "principal": 817.8015185147488, "balance": 8367.790330267244}, {"period": 3, "payment": 856.0748178846737, "interest": 34.86579304278018, "principal": 821.2090248418936, "balance": 7546.58130542535}, {"period": 4, "payment": 856.0748178846737, "interest": 31.444088772605625, "principal": 824.6307291120681, "balance": 6721.950576313282}, {"period": 5, "payment": 856.0748178846737, "interest": 28.00812740130534, "principal": 828.0666904833683, "balance": 5893.883885829913}, {"period": 6, "payment": 856.0748178846737, "interest": 24.557849524291306, "principal": 831.5169683603824, "balance": 5062.366917469531}, {"period": 7, "payment": 856.0748178846736, "interest": 21.093195489456377, "principal": 834.9816223952173, "balance": 4227.385295074313}, {"period": 8, "payment": 856.0748178846737, "interest": 17.61410539614297, "principal": 838.4607124885308, "balance": 3388.9245825857824}, {"period": 9, "payment": 856.0748178846737, "interest": 14.120519094107427, "principal": 841.9542987905663, "balance": 2546.9702837952163}, {"period": 10, "payment": 856.0748178846737, "interest": 10.612376182480068, "principal": 845.4624417021937, "balance": 1701.5078420930226}, {"period": 11, "payment": 856.0748178846737, "interest": 7.0896160087209275, "principal": 848.9852018759528, "balance": 852.5226402170698}, {"period": 12, "payment": 856.0748178846409, "interest": 3.552177667571124, "principal": 852.5226402170698, "balance": 0}]}
fin amortization <principal> <annual_rate> <years> <json_params>
Description
Loan schedule with parameters: periods_per_year (12), type (annuity or constant_principal), schedule (true)
Loan schedule with parameters: periods_per_year (12), type (annuity or constant_principal), schedule (true)
Parameters
principal: The principal - Number - required
annual_rate: The rate - Number - required
years: The years - Number - required
json_params: The parameters - String - required
principal: The principal - Number - required
annual_rate: The rate - Number - required
years: The years - Number - required
json_params: The parameters - String - required
admin
fin amortization 200000 0.035 20 "{\"schedule\": false}"
mentdb
{"type": "annuity", "periods": 240, "rate_per_period": 0.002916666666666667, "payment": 1159.9194359661835, "total_interest": 78380.66463188523, "total_paid": 278380.66463188524}
fin bond <face> <coupon_rate> <yield> <years>
Description
Bond with annual coupons: price, current yield, Macaulay and modified durations, convexity, DV01
Bond with annual coupons: price, current yield, Macaulay and modified durations, convexity, DV01
Parameters
face: The face value - Number - required
coupon_rate: The coupon rate - Number - required
yield: The yield to maturity - Number - required
years: The maturity in years - Number - required
face: The face value - Number - required
coupon_rate: The coupon rate - Number - required
yield: The yield to maturity - Number - required
years: The maturity in years - Number - required
admin
fin bond 100 0.04 0.05 10
mentdb
{"price": 92.27826507081515, "price_percent": 92.27826507081515, "current_yield": 0.0433471521915845, "macaulay_duration": 8.359589164010508, "modified_duration": 7.961513489533817, "convexity": 78.2942422798219, "dv01": 0.07346746521520721}
fin bond <face> <coupon_rate> <yield> <years> <json_params>
Description
Bond with parameters: frequency (coupons per year)
Bond with parameters: frequency (coupons per year)
Parameters
face: The face value - Number - required
coupon_rate: The coupon rate - Number - required
yield: The yield - Number - required
years: The maturity - Number - required
json_params: The parameters - String - required
face: The face value - Number - required
coupon_rate: The coupon rate - Number - required
yield: The yield - Number - required
years: The maturity - Number - required
json_params: The parameters - String - required
admin
fin bond 1000 0.06 0.05 5 "{\"frequency\": 2}"
mentdb
{"price": 1043.7603196548555, "price_percent": 104.37603196548555, "current_yield": 0.05748446158581737, "macaulay_duration": 4.408407590492557, "modified_duration": 4.30088545413908, "convexity": 22.079043263522394, "dv01": 0.44890935764111245}
fin black_scholes <spot> <strike> <years> <rate> <volatility>
Description
European call by Black-Scholes: price and greeks (delta, gamma, vega per point of volatility, theta per day, rho per point of rate)
European call by Black-Scholes: price and greeks (delta, gamma, vega per point of volatility, theta per day, rho per point of rate)
Parameters
spot: The spot price - Number - required
strike: The strike - Number - required
years: The maturity in years - Number - required
rate: The risk-free rate - Number - required
volatility: The volatility - Number - required
spot: The spot price - Number - required
strike: The strike - Number - required
years: The maturity in years - Number - required
rate: The risk-free rate - Number - required
volatility: The volatility - Number - required
admin
fin black_scholes 100 100 1 0.05 0.2
mentdb
{"type": "call", "price": 10.450583572185565, "delta": 0.6368306511756191, "gamma": 0.018762017345846895, "vega": 0.3752403469169379, "theta_per_day": -0.01757267820941972, "rho": 0.5323248154537634, "d1": 0.35000000000000003, "d2": 0.15000000000000002}
fin black_scholes <spot> <strike> <years> <rate> <volatility> <json_params>
Description
Black-Scholes with parameters: type (call or put), dividend (continuous yield)
Black-Scholes with parameters: type (call or put), dividend (continuous yield)
Parameters
spot: The spot - Number - required
strike: The strike - Number - required
years: The maturity - Number - required
rate: The rate - Number - required
volatility: The volatility - Number - required
json_params: The parameters - String - required
spot: The spot - Number - required
strike: The strike - Number - required
years: The maturity - Number - required
rate: The rate - Number - required
volatility: The volatility - Number - required
json_params: The parameters - String - required
admin
fin black_scholes 100 95 0.5 0.03 0.25 "{\"type\": \"put\", \"dividend\": 0.01}"
mentdb
{"type": "put", "price": 4.245414014981094, "delta": -0.3300847108953797, "gamma": 0.020426880948450275, "vega": 0.25533601185562843, "theta_per_day": -0.015331146449727445, "rho": -0.18626942552259534, "d1": 0.43511558046992077, "d2": 0.25833888517328385}
fin implied_vol <price> <spot> <strike> <years> <rate>
Description
Implied volatility of a European call from its price
Implied volatility of a European call from its price
Parameters
price: The option price - Number - required
spot: The spot - Number - required
strike: The strike - Number - required
years: The maturity - Number - required
rate: The rate - Number - required
price: The option price - Number - required
spot: The spot - Number - required
strike: The strike - Number - required
years: The maturity - Number - required
rate: The rate - Number - required
admin
fin implied_vol 10.45 100 100 1 0.05
mentdb
{"implied_volatility": 0.19998444801094373, "vega": 0.3752388148158723}
fin implied_vol <price> <spot> <strike> <years> <rate> <json_params>
Description
Implied volatility with parameters: type, dividend
Implied volatility with parameters: type, dividend
Parameters
price: The price - Number - required
spot: The spot - Number - required
strike: The strike - Number - required
years: The maturity - Number - required
rate: The rate - Number - required
json_params: The parameters - String - required
price: The price - Number - required
spot: The spot - Number - required
strike: The strike - Number - required
years: The maturity - Number - required
rate: The rate - Number - required
json_params: The parameters - String - required
admin
fin implied_vol 5.57 100 100 1 0.05 "{\"type\": \"put\"}"
mentdb
{"implied_volatility": 0.19990603180603211, "vega": 0.37523108292387264}
