{"id":1165,"date":"2015-10-13T15:37:14","date_gmt":"2015-10-13T13:37:14","guid":{"rendered":"http:\/\/blog.the-leviathan.ch\/?p=1165"},"modified":"2015-10-13T16:09:55","modified_gmt":"2015-10-13T14:09:55","slug":"money-printer","status":"publish","type":"post","link":"https:\/\/blog.the-leviathan.ch\/?p=1165","title":{"rendered":"&#8220;Money printer&#8221;"},"content":{"rendered":"<p>Hi<br \/>\nI&#8217;m working on a python script which uses a cascaded triangular arbitrash in order to multiply money.<br \/>\nBut so far the calculations seem to be all unsatisfying.<br \/>\n<a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2015\/10\/screeny17.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1166\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2015\/10\/screeny17.png\" alt=\"screeny17\" width=\"1653\" height=\"825\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2015\/10\/screeny17.png 1653w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2015\/10\/screeny17-300x150.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2015\/10\/screeny17-1024x511.png 1024w\" sizes=\"auto, (max-width: 1653px) 100vw, 1653px\" \/><\/a><br \/>\nWhat I&#8217;m doing so far is fetching and filtering and interpolating the values in order to estimate the trade development:<\/p>\n<pre>#!\/usr\/bin\/python\r\nimport sys\r\nimport os\r\nimport copy\r\nimport math\r\n\r\n# delays:\r\nfrom time import sleep\r\n\r\n# web api\r\nfrom Cryptsy import Api\r\n\r\n#plotting the stuff\r\nimport matplotlib\r\nmatplotlib.use(\"TkAgg\")\r\nfrom matplotlib.pyplot import plot\r\nfrom matplotlib.pyplot import figure\r\nfrom matplotlib.pyplot import close\r\nfrom matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg\r\nfrom IPython import display\r\n\r\n#numpy stuff:\r\nfrom numpy import delete\r\nfrom numpy import array\r\nfrom numpy import linspace\r\nfrom numpy import polyfit\r\nfrom numpy import poly1d\r\nfrom numpy import newaxis\r\nfrom numpy import ones\r\n\r\n#scipy stuff\r\nfrom scipy.signal import wiener\r\nfrom scipy.optimize import curve_fit\r\nfrom scipy.ndimage.filters import convolve1d\r\nfrom scipy.interpolate import interp1d\r\nfrom scipy.interpolate import InterpolatedUnivariateSpline\r\nfrom scipy.signal import wiener\r\nfrom scipy.signal import gaussian\r\nfrom scipy.signal import savgol_filter\r\n\r\n#sklearn\r\nfrom sklearn.gaussian_process import GaussianProcess\r\nfrom sklearn.linear_model import LinearRegression\r\nfrom sklearn.isotonic import IsotonicRegression\r\nfrom sklearn.cross_validation import cross_val_predict\r\nfrom sklearn.preprocessing import PolynomialFeatures\r\nfrom sklearn.pipeline import Pipeline\r\nfrom sklearn.utils import check_random_state\r\n\r\n#pyqt fit\r\nfrom pyqt_fit import npr_methods\r\nimport pyqt_fit.nonparam_regression as smooth\r\n<\/pre>\n<p>&#8230;<\/p>\n<pre>\r\n\tx = linspace(1, len(price_array), len(price_array))\r\n\ty = array(price_array)\r\n\tfiltered_y = savgol_filter(y, window_length, savgol_filter_polyorder)\r\n\r\n\tk0 = smooth.NonParamRegression(x, filtered_y, method=npr_methods.LocalPolynomialKernel(q=gauss_poly_deg))\r\n\tk0.fit()\r\n\tz = k0(x)\r\n\r\n\tavg_diff_number=len(x)\/4\r\n\r\n\tnew_x=x[len(x)-avg_diff_number-1:]\r\n\tnew_z=z[len(z)-avg_diff_number-1:]\r\n\tclf = LinearRegression()\r\n\tclf.fit(new_x[:,newaxis],new_z)\r\n\ttangent=clf.predict(new_x[:,newaxis])\r\n\r\n\tnum_different=(tangent[-1]-tangent[0])\/(new_x[-1]-new_x[0])\r\n<\/pre>\n<p>If someone has a better idea: <b>Please say so!<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi I&#8217;m working on a python script which uses a cascaded triangular arbitrash in order to multiply money. But so far the calculations seem to be all unsatisfying. What I&#8217;m doing so far is fetching and filtering and interpolating the values in order to estimate the trade development: #!\/usr\/bin\/python import sys import os import copy &hellip; <a href=\"https:\/\/blog.the-leviathan.ch\/?p=1165\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">&#8220;Money printer&#8221;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1165","post","type-post","status-publish","format-standard","hentry","category-daily"],"_links":{"self":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1165"}],"version-history":[{"count":5,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1165\/revisions"}],"predecessor-version":[{"id":1171,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1165\/revisions\/1171"}],"wp:attachment":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}