diff --git a/figwheel_server.log b/figwheel_server.log index a117d48..61429c9 100644 --- a/figwheel_server.log +++ b/figwheel_server.log @@ -865,3 +865,5126 @@ notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wu Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.533 seconds. notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +---- Compiler Warning on target/cljsbuild/public/js/out/cognitect/transit.cljs line:332 column:1 ---- + + uri? already refers to: cljs.core/uri? being replaced by: cognitect.transit/uri? + + 328  "Construct a URI from a string." + 329  [s] + 330  (ty/uri s)) + 331  + 332 (defn uri? +   ^--- uri? already refers to: cljs.core/uri? being replaced by: cognitect.transit/uri? + 333  "Returns true if x is a transit URI value, false otherwise." + 334  [x] + 335  (ty/isURI x)) + 336  + 337 (defn uuid + +---- Compiler Warning : Please see target/cljsbuild/public/js/out/cognitect/transit.cljs ---- +Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 1.21 seconds. +notifying browser that file changed: target/cljsbuild/public/js/out/goog/deps.js +notifying browser that file changed: target/cljsbuild/public/js/out/cljs_deps.js +notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Failed to compile build :app from ["src/cljs" "src/cljc" "env/dev/cljs"] in 0.301 seconds. +---- Could not Analyze src/cljs/skirmish/wui/components/securities_page.cljs ---- + + No such namespace: cljs.core.async.macros, could not locate cljs/core/async/macros.cljs, cljs/core/async/macros.cljc, or JavaScript source providing "cljs.core.async.macros"  + +---- Analysis Error : Please see src/cljs/skirmish/wui/components/securities_page.cljs ---- +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.567 seconds. +notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.578 seconds. +notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.578 seconds. +notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.542 seconds. +notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.494 seconds. +notifying browser that file changed: target/cljsbuild/public/js/out/cljs_deps.js +notifying browser that file changed: target/cljsbuild/public/js/out/skirmish/wui/components/securities_page.js +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Failed to compile build :app from ["src/cljs" "src/cljc" "env/dev/cljs"] in 0.279 seconds. +---- Could not Read src/cljs/skirmish/wui/components/securities_page.cljs line:33 ---- + + /home/didier/gitlab/skirmish/book/src/cljs/skirmish/wui/components/securities_page.cljs [line 33, col 50] Unexpected EOF while reading item 6 of list, starting at line 20 and column 1. + + 31 table-head + 32 [:tbody + 33  (for [sec securities] (create-row sec))]])) +    /home/didier/gitlab/skirmish/book/src/cljs/skirmish/wui/components/securities_page.cljs [line 33, col 50] Unexpected EOF while reading item 6 of list, starting at line 20 and column 1. + +---- Reader Error : Please see src/cljs/skirmish/wui/components/securities_page.cljs ---- +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Failed to compile build :app from ["src/cljs" "src/cljc" "env/dev/cljs"] in 0.287 seconds. +---- Could not Read src/cljs/skirmish/wui/components/securities_page.cljs line:34 ---- + + /home/didier/gitlab/skirmish/book/src/cljs/skirmish/wui/components/securities_page.cljs [line 34, col 50] Unexpected EOF while reading item 4 of list, starting at line 21 and column 3. + + 32 table-head + 33 [:tbody + 34  (for [sec securities] (create-row sec))]])) +    /home/didier/gitlab/skirmish/book/src/cljs/skirmish/wui/components/securities_page.cljs [line 34, col 50] Unexpected EOF while reading item 4 of list, starting at line 21 and column 3. + +---- Reader Error : Please see src/cljs/skirmish/wui/components/securities_page.cljs ---- +Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]... +Failed to compile build :app from ["src/cljs" "src/cljc" "env/dev/cljs"] in 0.286 seconds. +---- Could not Analyze src/cljs/skirmish/wui/components/securities_page.cljs ---- + + Invalid :refer, macro cljs.core.async.macros/ api-routes api (wrap-cors :access-control-allow-origin #"http://localhost:3449" + :access-control-allow-methods [:get :put :post :delete])) + bookkeeper-config))) diff --git a/src/clj/skirmish/broker/core.clj b/src/clj/skirmish/broker/core.clj new file mode 100644 index 0000000..cd7871c --- /dev/null +++ b/src/clj/skirmish/broker/core.clj @@ -0,0 +1,4 @@ +(ns skirmish.broker.core) + + +(defn -main [config exchange-apis]) \ No newline at end of file diff --git a/src/clj/skirmish/core.clj b/src/clj/skirmish/core.clj index 49efe27..4ce9828 100644 --- a/src/clj/skirmish/core.clj +++ b/src/clj/skirmish/core.clj @@ -1,9 +1,10 @@ (ns skirmish.core (:require [skirmish.cli.core] - [skirmish.rest.core] [skirmish.cli.benchmark] [skirmish.exchange.core] [skirmish.wui.server] + [skirmish.bookkeeper.core] + [skirmish.exchange-gateway.core] [skirmish.middleware.core :refer [create-exchange-apis-for]] [aero.core :refer (read-config)] [orchestra.spec.test :as st] @@ -12,9 +13,9 @@ (def targets ;; a target is a function that blocks the thread and takes two ;; arguments: the config map and the "exchange-api" - {:api-server skirmish.rest.core/api-main + {:api-server skirmish.exchange-gateway.core/-main :exchange-core skirmish.exchange.core/-main ;; should be skirmish.exchange.core/api-main - :api-bookkeeper skirmish.rest.core/bookkeeper-main + :api-bookkeeper skirmish.bookkeeper.core/-main :wui skirmish.wui.server/-main}) (defn run-all-targets-in-separate-threads [target-fns config exchange-apis] diff --git a/src/clj/skirmish/exchange_gateway/core.clj b/src/clj/skirmish/exchange_gateway/core.clj new file mode 100644 index 0000000..a492829 --- /dev/null +++ b/src/clj/skirmish/exchange_gateway/core.clj @@ -0,0 +1,17 @@ +(ns skirmish.exchange-gateway.core + (:require [org.httpkit.server :refer [run-server]] + [compojure.handler :refer [api]] + [skirmish.util :refer [block-thread]] + [skirmish.middleware.core :refer [create-exchange-apis-for]] + [skirmish.exchange-gateway.exchange-gateway :refer [create-routes-for-exchange]] + [ring.middleware.cors :refer [wrap-cors]])) + + +(defn -main [config exchange-apis] + (let [webserver-config (:api-server config) + api-routes (create-routes-for-exchange exchange-apis)] + (println "Running server with bellow config") + (println webserver-config) + (run-server (api api-routes) webserver-config))) + + diff --git a/src/clj/skirmish/rest/exchange.clj b/src/clj/skirmish/exchange_gateway/exchange_gateway.clj similarity index 98% rename from src/clj/skirmish/rest/exchange.clj rename to src/clj/skirmish/exchange_gateway/exchange_gateway.clj index af29bdd..cf3c1b3 100644 --- a/src/clj/skirmish/rest/exchange.clj +++ b/src/clj/skirmish/exchange_gateway/exchange_gateway.clj @@ -1,4 +1,4 @@ -(ns skirmish.rest.exchange +(ns skirmish.exchange-gateway.exchange-gateway (:require [skirmish.exchange.exchange :refer [empty-book create-exchange-for-security]] [org.httpkit.server :refer [run-server with-channel send! close on-close]] [compojure.route :refer [not-found]] diff --git a/src/clj/skirmish/rest/core.clj b/src/clj/skirmish/rest/core.clj deleted file mode 100644 index a4e9bc4..0000000 --- a/src/clj/skirmish/rest/core.clj +++ /dev/null @@ -1,23 +0,0 @@ -(ns skirmish.rest.core - (:require [org.httpkit.server :refer [run-server]] - [compojure.handler :refer [api]] - [skirmish.util :refer [block-thread]] - [skirmish.middleware.core :refer [create-exchange-apis-for]] - [skirmish.rest.bookkeeper :refer [create-routes-for-bookkeeper]] - [skirmish.rest.exchange :refer [create-routes-for-exchange]])) - - -(defn api-main [config exchange-apis] - (let [webserver-config (:api-server config) - api-routes (create-routes-for-exchange exchange-apis)] - (println "Running server with bellow config") - (println webserver-config) - (run-server (api api-routes) webserver-config))) - - -(defn bookkeeper-main [config exchange-apis] - (let [webserver-config (:api-bookkeeper config) - api-routes (create-routes-for-bookkeeper exchange-apis)] - (println "Running server with bellow config") - (println webserver-config) - (run-server (api api-routes) webserver-config))) diff --git a/src/clj/skirmish/rest/util.clj b/src/clj/skirmish/rest/util.clj index 2d08646..49b56d2 100644 --- a/src/clj/skirmish/rest/util.clj +++ b/src/clj/skirmish/rest/util.clj @@ -2,7 +2,7 @@ (:require [cheshire.core :refer [generate-string]] [clojure.string :refer [split starts-with? ends-with?]])) - +;; Access-Control-Allow-Origin (def mime-types [["application/json" generate-string] diff --git a/src/clj/skirmish/strategies/core.clj b/src/clj/skirmish/strategies/core.clj new file mode 100644 index 0000000..e7a3e59 --- /dev/null +++ b/src/clj/skirmish/strategies/core.clj @@ -0,0 +1,39 @@ +(ns skirmish.strategies.core + (:require [clojure.core.async :as async :refer [>! strat :sec-id name) + one-day (* 24 3600 1000) + from (- msecs (-> strat :look-back-in-days (* one-day))) + period (:period strat) + to msecs] + (format "/api/v1/securities/%s/l1?from=%s&to=%s&period=period" sec-id from to period)))) + + +(defn get-data-for-strategy [strategy]) + + +(defn make-trades [wanted-trades]) + + +(defn framework [strategy msecs] + (async/go-loop [_ (