Skip to content

Instantly share code, notes, and snippets.

@nidkil
nidkil / PT_EMA_SMA_SPREAD
Last active January 31, 2018 08:44
Tradeview Pinescript to visualize ProfitTrailer EMASPREAD and SMASPREAD strategy.
//@version=3
study(title="EMA and SMA Spread", shorttitle="EMASMASPREAD", overlay=false)
// Parameters
param_buy_value_conservative = input(0.1)
param_buy_value_moderate = input(0.5)
param_buy_value_aggresive = input(0.25)
param_ema_fast = input(5)
param_ema_slow = input(20)
param_sma_fast = input(5)
"""
Standalone test class that sets up a basic API that supports both JSON and XML. It is a single class setup so
that it is easy to follow.
Some quick pointers:
- If a multi line docstring is present in any function, it will be displayed in the Swagger UI as
"Implementation Notes". Use the Markdown syntax to format these notes, see
https://daringfireball.net/projects/markdown/syntax.
- Namespaces allow the API operations to be split into separate files, each defining a part of the API with a
different URL prefix.
from flask import Flask, Blueprint, url_for, jsonify
from flask_restplus import Api, Resource
from flask_marshmallow import Marshmallow, base_fields
from marshmallow import post_dump
# Setup Flask app
url_prefix = '/api/v4'
doc = '/apidoc/'
app = Flask(__name__)
@nidkil
nidkil / JsonTestServlet.scala
Created December 2, 2014 19:47
Halt does not work with JacksonJsonSupport trait mixed in
package com.nidkil.jsontest
import org.json4s.{Formats, DefaultFormats}
import org.scalatra._
import org.scalatra.json._
import scalate.ScalateSupport
class JsonTestServlet extends ScalatraServlet with JacksonJsonSupport {
protected implicit val jsonFormats: Formats = DefaultFormats