This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
var ws = new WebSocket("ws://localhost:8080/ws/mobile"); | |
function formatMessage(m) { | |
return JSON.stringify(m); | |
} | |
function joinRoom(code) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allocations = %{"IAU" => 10, "TLT" => 10, "VGSH" => 10, "VTI" => 10} | |
orders = Rebalancex.rebalance_portfolio(allocations) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Rebalancex do | |
alias Rebalancex.Quote | |
@underweight 0.25 | |
@overweight 0.27 | |
def rebalance_portfolio(allocations, quote_service \\ Quote) do | |
portfolio = %{cash: 0, allocations: allocations} | |
prices = get_prices(allocations, quote_service) |
OlderNewer