Skip to content

Commit

Permalink
fixes for web interface
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkolotaev committed Feb 27, 2014
1 parent 6909498 commit 0118b1b
Show file tree
Hide file tree
Showing 16 changed files with 3,410 additions and 2,943 deletions.
1 change: 0 additions & 1 deletion marketsim/_pub/strategy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

import side
import weight
import lp
import price
import position
import account
4 changes: 0 additions & 4 deletions marketsim/_pub/strategy/lp/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions marketsim/gen/.output/names.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1322,27 +1322,6 @@ package strategy

}

package lp
{
/** Liquidity provider for one side
*/
def OneSide(/** initial price which is taken if orderBook is empty */ initialValue = 100.0,
/** defines multipliers for current asset price when price of
* order to create is calculated*/ priceDistr = .math.random.lognormvariate(0.0,0.1),
/** Event source making the strategy to wake up*/ eventGen = .event.Every(.math.random.expovariate(1.0)),
/** order factory function*/ orderFactory = .order.side_price.Limit(),
/** side of orders to create */ side = .side.Sell() : .IFunction[.Side]) = .strategy.Generic(orderFactory(side,.strategy.price.LiquidityProvider(side,initialValue,priceDistr)),eventGen)

/** Liquidity provider for two sides
*/
def TwoSide(/** initial price which is taken if orderBook is empty */ initialValue = 100.0,
/** defines multipliers for current asset price when price of
* order to create is calculated*/ priceDistr = .math.random.lognormvariate(0.0,0.1),
/** Event source making the strategy to wake up*/ eventGen = .event.Every(.math.random.expovariate(1.0)),
/** order factory function*/ orderFactory = .order.side_price.Limit()) = .strategy.Array([.strategy.lp.OneSide(initialValue,priceDistr,eventGen,orderFactory,.side.Sell()),.strategy.lp.OneSide(initialValue,priceDistr,eventGen,orderFactory,.side.Buy())])

}

@category = "Price function"
package price
{
Expand Down
24 changes: 0 additions & 24 deletions marketsim/gen/.output/typed.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1877,30 +1877,6 @@ package strategy {@category = "Side function"
= .trader.EfficiencyTrend(trader,alpha)
}


package lp {
/** Liquidity provider for one side
*/

def OneSide(/** initial price which is taken if orderBook is empty */ initialValue : Optional[.Float] = 100.0,
/** defines multipliers for current asset price when price of
* order to create is calculated*/ priceDistr : Optional[() => .Float] = .math.random.lognormvariate(0.0,0.1),
/** Event source making the strategy to wake up*/ eventGen : Optional[.IEvent] = .event.Every(.math.random.expovariate(1.0)),
/** order factory function*/ orderFactory : Optional[((() => .Side),(() => .Float)) => .IObservable[.IOrder]] = .order._curried.sideprice_Limit(),
/** side of orders to create */ side : Optional[() => .Side] = .side.Sell() : () => .Side) : .ISingleAssetStrategy
= .strategy.Generic(orderFactory(side,.strategy.price.LiquidityProvider(side,initialValue,priceDistr)),eventGen)

/** Liquidity provider for two sides
*/

def TwoSide(/** initial price which is taken if orderBook is empty */ initialValue : Optional[.Float] = 100.0,
/** defines multipliers for current asset price when price of
* order to create is calculated*/ priceDistr : Optional[() => .Float] = .math.random.lognormvariate(0.0,0.1),
/** Event source making the strategy to wake up*/ eventGen : Optional[.IEvent] = .event.Every(.math.random.expovariate(1.0)),
/** order factory function*/ orderFactory : Optional[((() => .Side),(() => .Float)) => .IObservable[.IOrder]] = .order._curried.sideprice_Limit()) : .ISingleAssetStrategy
= .strategy.Array([.strategy.lp.OneSide(initialValue,priceDistr,eventGen,orderFactory,.side.Sell()),.strategy.lp.OneSide(initialValue,priceDistr,eventGen,orderFactory,.side.Buy())])
}

@category = "Price function"

package price {
Expand Down
21 changes: 2 additions & 19 deletions marketsim/gen/.parsed/defs/strategies/sideprice.pretty-printed.sc
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,7 @@ package strategy() {
/** defines multipliers for current asset price when price of
* order to create is calculated*/ priceDistr = math.random.lognormvariate(0.0,0.1)) = Array([LiquidityProviderSide(eventGen,orderFactory,side.Sell(),initialValue,priceDistr),LiquidityProviderSide(eventGen,orderFactory,side.Buy(),initialValue,priceDistr)])

package lp(/** initial price which is taken if orderBook is empty */ initialValue = 100.0,
/** defines multipliers for current asset price when price of
* order to create is calculated*/ priceDistr = math.random.lognormvariate(0.0,0.1)) {
// defined at defs\strategies\sideprice.sc: 51.9
/** Liquidity provider for one side
*/
def OneSide(/** Event source making the strategy to wake up*/ eventGen = event.Every(math.random.expovariate(1.0)),
/** order factory function*/ orderFactory = order.side_price.Limit(),
/** side of orders to create */ side = .side.Sell() : IFunction[Side]) = Generic(orderFactory(side,price.LiquidityProvider(side,initialValue,priceDistr)),eventGen)

// defined at defs\strategies\sideprice.sc: 70.9
/** Liquidity provider for two sides
*/
def TwoSide(/** Event source making the strategy to wake up*/ eventGen = event.Every(math.random.expovariate(1.0)),
/** order factory function*/ orderFactory = order.side_price.Limit()) = Array([OneSide(eventGen,orderFactory,side.Sell()),OneSide(eventGen,orderFactory,side.Buy())])
}

// defined at defs\strategies\sideprice.sc: 84.5
// defined at defs\strategies\sideprice.sc: 45.5
/** A Strategy that allows to drive the asset price based on historical market data
* by creating large volume orders for the given price.
*
Expand All @@ -51,7 +34,7 @@ package strategy() {
/** Price difference between orders placed and underlying quotes */ delta = 1.0,
/** Volume of Buy/Sell orders. Should be large compared to the volumes of other traders. */ volume = 1000.0) = Combine(order.price.Limit(side.Sell(),volume*1000)~>FloatingPrice(ticker~>Quote(start,end)+delta~>BreaksAtChanges)~>Iceberg(volume)~>Strategy(event.After(0.0)),order.price.Limit(side.Buy(),volume*1000)~>FloatingPrice(ticker~>Quote(start,end)-delta~>BreaksAtChanges)~>Iceberg(volume)~>Strategy(event.After(0.0)))

// defined at defs\strategies\sideprice.sc: 117.5
// defined at defs\strategies\sideprice.sc: 78.5
def MarketMaker(delta = 1.0,
volume = 20.0) = Combine(order.price.Limit(side.Sell(),volume*1000)~>FloatingPrice(orderbook.Asks()~>SafeSidePrice(100+delta)/trader.Position()~>Atan/1000~>Exp~>OnEveryDt(0.9)~>BreaksAtChanges)~>Iceberg(volume)~>Strategy(event.After(0.0)),order.price.Limit(side.Buy(),volume*1000)~>FloatingPrice(orderbook.Bids()~>SafeSidePrice(100-delta)/trader.Position()~>Atan/1000~>Exp~>OnEveryDt(0.9)~>BreaksAtChanges)~>Iceberg(volume)~>Strategy(event.After(0.0)))
}
212 changes: 0 additions & 212 deletions marketsim/gen/.parsed/defs/strategies/sideprice.raw
Original file line number Diff line number Diff line change
Expand Up @@ -241,218 +241,6 @@ Definitions:
| | | | | | | - Liquidity provider for two sides
| | | | | | | - List:
| | | | | - List:
| | | | - PackageDef:
| | | | | - Some:
| | | | | | - QualifiedName:
| | | | | | | - List:
| | | | | | | | - lp
| | | | | - List:
| | | | | | - Parameter:
| | | | | | | - initialValue
| | | | | | | - None
| | | | | | | - Some:
| | | | | | | | - FloatLit:
| | | | | | | | | - 100.0
| | | | | | | - List:
| | | | | | | | - initial price which is taken if orderBook is empty
| | | | | | - Parameter:
| | | | | | | - priceDistr
| | | | | | | - None
| | | | | | | - Some:
| | | | | | | | - FunCall:
| | | | | | | | | - QualifiedName:
| | | | | | | | | | - List:
| | | | | | | | | | | - math
| | | | | | | | | | | - random
| | | | | | | | | | | - lognormvariate
| | | | | | | | | - List:
| | | | | | | | | | - FloatLit:
| | | | | | | | | | | - 0.0
| | | | | | | | | | - FloatLit:
| | | | | | | | | | | - 0.1
| | | | | | | - List:
| | | | | | | | - defines multipliers for current asset price when price of
| | | | | | | | - order to create is calculated
| | | | | - Definitions:
| | | | | | - List:
| | | | | | | - FunDef:
| | | | | | | | - OneSide
| | | | | | | | - List:
| | | | | | | | | - Parameter:
| | | | | | | | | | - eventGen
| | | | | | | | | | - None
| | | | | | | | | | - Some:
| | | | | | | | | | | - FunCall:
| | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | - event
| | | | | | | | | | | | | | - Every
| | | | | | | | | | | | - List:
| | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | - math
| | | | | | | | | | | | | | | | - random
| | | | | | | | | | | | | | | | - expovariate
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | - FloatLit:
| | | | | | | | | | | | | | | | - 1.0
| | | | | | | | | | - List:
| | | | | | | | | | | - Event source making the strategy to wake up
| | | | | | | | | - Parameter:
| | | | | | | | | | - orderFactory
| | | | | | | | | | - None
| | | | | | | | | | - Some:
| | | | | | | | | | | - FunCall:
| | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | - order
| | | | | | | | | | | | | | - side_price
| | | | | | | | | | | | | | - Limit
| | | | | | | | | | | | - List:
| | | | | | | | | | - List:
| | | | | | | | | | | - order factory function
| | | | | | | | | - Parameter:
| | | | | | | | | | - side
| | | | | | | | | | - None
| | | | | | | | | | - Some:
| | | | | | | | | | | - Cast:
| | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | -
| | | | | | | | | | | | | | | - side
| | | | | | | | | | | | | | | - Sell
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | - SimpleType:
| | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | - IFunction
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | - SimpleType:
| | | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | | - Side
| | | | | | | | | | | | | | | - List:
| | | | | | | | | | - List:
| | | | | | | | | | | - side of orders to create
| | | | | | | | - Some:
| | | | | | | | | - FunCall:
| | | | | | | | | | - QualifiedName:
| | | | | | | | | | | - List:
| | | | | | | | | | | | - Generic
| | | | | | | | | | - List:
| | | | | | | | | | | - FunCall:
| | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | - orderFactory
| | | | | | | | | | | | - List:
| | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | - side
| | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | - price
| | | | | | | | | | | | | | | | - LiquidityProvider
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - side
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - initialValue
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - priceDistr
| | | | | | | | | | | - Var:
| | | | | | | | | | | | - eventGen
| | | | | | | | - None
| | | | | | | | - Some:
| | | | | | | | | - DocString:
| | | | | | | | | | - Liquidity provider for one side
| | | | | | | | | | - List:
| | | | | | | | - List:
| | | | | | | - FunDef:
| | | | | | | | - TwoSide
| | | | | | | | - List:
| | | | | | | | | - Parameter:
| | | | | | | | | | - eventGen
| | | | | | | | | | - None
| | | | | | | | | | - Some:
| | | | | | | | | | | - FunCall:
| | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | - event
| | | | | | | | | | | | | | - Every
| | | | | | | | | | | | - List:
| | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | - math
| | | | | | | | | | | | | | | | - random
| | | | | | | | | | | | | | | | - expovariate
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | - FloatLit:
| | | | | | | | | | | | | | | | - 1.0
| | | | | | | | | | - List:
| | | | | | | | | | | - Event source making the strategy to wake up
| | | | | | | | | - Parameter:
| | | | | | | | | | - orderFactory
| | | | | | | | | | - None
| | | | | | | | | | - Some:
| | | | | | | | | | | - FunCall:
| | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | - order
| | | | | | | | | | | | | | - side_price
| | | | | | | | | | | | | | - Limit
| | | | | | | | | | | | - List:
| | | | | | | | | | - List:
| | | | | | | | | | | - order factory function
| | | | | | | | - Some:
| | | | | | | | | - FunCall:
| | | | | | | | | | - QualifiedName:
| | | | | | | | | | | - List:
| | | | | | | | | | | | - Array
| | | | | | | | | | - List:
| | | | | | | | | | | - List_:
| | | | | | | | | | | | - List:
| | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | - OneSide
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - eventGen
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - orderFactory
| | | | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | | | - side
| | | | | | | | | | | | | | | | | | - Sell
| | | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | - OneSide
| | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - eventGen
| | | | | | | | | | | | | | | - Var:
| | | | | | | | | | | | | | | | - orderFactory
| | | | | | | | | | | | | | | - FunCall:
| | | | | | | | | | | | | | | | - QualifiedName:
| | | | | | | | | | | | | | | | | - List:
| | | | | | | | | | | | | | | | | | - side
| | | | | | | | | | | | | | | | | | - Buy
| | | | | | | | | | | | | | | | - List:
| | | | | | | | - None
| | | | | | | | - Some:
| | | | | | | | | - DocString:
| | | | | | | | | | - Liquidity provider for two sides
| | | | | | | | | | - List:
| | | | | | | | - List:
| | | | | - List:
| | | | | - List:
| | | | | - false
| | | | - FunDef:
| | | | | - MarketData
| | | | | - List:
Expand Down
8 changes: 0 additions & 8 deletions marketsim/gen/_out/_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ def constant(self):
from marketsim.gen._out._constant import constant
return constant(self)

def TwoSide(self, priceDistr = None,eventGen = None,orderFactory = None):
from marketsim.gen._out.strategy.lp._twoside import TwoSide
return TwoSide(self,priceDistr,eventGen,orderFactory)

def normalvariate(self, Sigma = None):
from marketsim.gen._out.math.random._normalvariate import normalvariate
return normalvariate(self,Sigma)
Expand All @@ -33,10 +29,6 @@ def TrendFollower(self, threshold = None,book = None):
from marketsim.gen._out.strategy.side._trendfollower import TrendFollower
return TrendFollower(self,threshold,book)

def OneSide(self, priceDistr = None,eventGen = None,orderFactory = None,side = None):
from marketsim.gen._out.strategy.lp._oneside import OneSide
return OneSide(self,priceDistr,eventGen,orderFactory,side)

@property
def trader_TraderEfficiencyTrend(self):
from marketsim.gen._out.strategy.weight.trader._trader_traderefficiencytrend import trader_TraderEfficiencyTrend
Expand Down
Empty file.
Loading

0 comments on commit 0118b1b

Please sign in to comment.