Commits

Oliver Gu  committed ba1f553

Extended example to print portfolio updates

  • Participants
  • Parent commits 8ae1b1b

Comments (0)

Files changed (1)

File examples/buy_market_order.ml

         | `Filled ->
           after (sec 0.5) >>> (fun () -> Tws.cancel_order_status tws oid)
         | _ -> ()
-      end))
+      end)
+    >>= fun () ->
+    Tws.account_and_portfolio_updates_exn tws
+    >>= fun updates ->
+    Pipe.iter_without_pushback updates ~f:(function
+      | `Portfolio_update x ->
+        print_endline (Sexp.to_string_hum (Portfolio_update.sexp_of_t x));
+      | _ -> ())
+  )
 
 let command =
   Command.async_basic ~summary:"submit market buy order for AAPL"