From 2b054ef8b065ebf376a1265bec5eca91e7b79052 Mon Sep 17 00:00:00 2001 From: Valentin Trinque Date: Fri, 5 Mar 2021 15:58:08 +0100 Subject: [PATCH 1/3] Remove outdated feature tests --- integration/README.md | 4 +- integration/core_test.go | 383 ------------------ integration/execution_layer_test.go | 19 - .../features/1847-closeout-long.feature | 2 - .../1847-closeout-short-with-fees.feature | 2 - .../features/1847-closeout-short.feature | 2 - ...tressed-trader-has-general-balance.feature | 5 - ...2952-opening-auction-extension-csv.feature | 18 +- integration/features/amend-order.feature | 11 +- integration/features/core.feature | 59 --- ...rk_settlement_using_insurance_pool.feature | 5 - integration/features/market-depth-1.feature | 4 - integration/features/market-depth-2.feature | 7 +- integration/features/market-depth-3.feature | 4 - integration/features/market-depth-4.feature | 12 +- integration/features/simple.feature | 68 ---- .../verified-loss-socialization-case1.feature | 2 +- integration/main_test.go | 11 - integration/setup_test.go | 82 +--- 19 files changed, 27 insertions(+), 673 deletions(-) delete mode 100644 integration/core_test.go delete mode 100644 integration/features/core.feature delete mode 100644 integration/features/simple.feature diff --git a/integration/README.md b/integration/README.md index a619243900..5ac94523b8 100644 --- a/integration/README.md +++ b/integration/README.md @@ -33,7 +33,7 @@ The `-v` flag tells `go test` to run with verbose output (sending logging to std To run only certain tests (feature files), you can simply add the paths to a given feature file to the command: ```shell -go test -v ./integration/... -godog.format=pretty $(pwd)/integration/features/simple.feature +go test -v ./integration/... -godog.format=pretty $(pwd)/integration/features/my-feature.feature ``` ## Race detection and cache @@ -51,7 +51,7 @@ Should there be tests that are intermittently failing, this could indicate a dat go test -v -count=1 -race ./integration/... -godog.format=pretty # Same as above, but only run a specific feature file: -go test -v -count=1 -race ./integration/... -godog.format=pretty $(pwd)/integration/feature/core.feature +go test -v -count=1 -race ./integration/... -godog.format=pretty $(pwd)/integration/feature/my-feature.feature ``` Race detection is a complex thing to do, so it will make running tests significantly slower. The pipeline runs the tests with race detection, so this shouldn't be required to do locally. diff --git a/integration/core_test.go b/integration/core_test.go deleted file mode 100644 index bf14a0cc00..0000000000 --- a/integration/core_test.go +++ /dev/null @@ -1,383 +0,0 @@ -package core_test - -import ( - "context" - "fmt" - "strconv" - "strings" - "time" - - // cmocks "code.vegaprotocol.io/vega/collateral/mocks" - "code.vegaprotocol.io/vega/execution" - "code.vegaprotocol.io/vega/fee" - "code.vegaprotocol.io/vega/logging" - "code.vegaprotocol.io/vega/matching" - "code.vegaprotocol.io/vega/monitor" - "code.vegaprotocol.io/vega/positions" - "code.vegaprotocol.io/vega/proto" - oraclesv1 "code.vegaprotocol.io/vega/proto/oracles/v1" - "code.vegaprotocol.io/vega/risk" - "code.vegaprotocol.io/vega/settlement" - - "github.com/cucumber/godog/gherkin" - uuid "github.com/satori/go.uuid" -) - -var ( - core *execution.Market -) - -func initialiseMarket(row *gherkin.TableRow, mkt *proto.Market) { - // the header of the feature file (ie where to find the data in the row) looks like this: - // | name | markprice | risk model | lamd | tau | mu | r | sigma | release factor | initial factor | search factor | - - // general stuff like name, ID, code, asset, and initial mark price - // mkt.TradingMode = proto.Market_TRADING_MODE_CONTINUOUS - // mkt.State = proto.Market_STATE_ACTIVE - parts := strings.Split(row.Cells[0].Value, "/") - mkt.Id = fmt.Sprintf("Crypto/%s/Futures/%s", parts[0], parts[1]) - mkt.TradableInstrument.Instrument.Code = fmt.Sprintf("FX:%s%s", parts[0], parts[1]) - prod := mkt.TradableInstrument.Instrument.GetFuture() - prod.SettlementAsset = parts[0] - mkt.TradableInstrument.Instrument.Product = &proto.Instrument_Future{ - Future: prod, - } // set asset, reassign the product - mkt.TradableInstrument.Instrument.InitialMarkPrice, _ = strconv.ParseUint(row.Cells[1].Value, 10, 64) - - // whether it's lambd/tau or short/long depends on the risk model - lambdShort, _ := strconv.ParseFloat(row.Cells[3].Value, 64) - tauLong, _ := strconv.ParseFloat(row.Cells[4].Value, 64) - // we'll always need to use these - release, _ := strconv.ParseFloat(row.Cells[8].Value, 64) - initial, _ := strconv.ParseFloat(row.Cells[9].Value, 64) - search, _ := strconv.ParseFloat(row.Cells[10].Value, 64) - //openAuctionDuration, _ := strconv.ParseInt(row.Cells[11].Value, 10, 64) - if row.Cells[12].Value != "continuous" { - batchDuration, _ := strconv.ParseInt(row.Cells[12].Value, 10, 64) - mkt.TradingModeConfig = &proto.Market_Discrete{ - Discrete: &proto.DiscreteTrading{ - DurationNs: batchDuration, - }, - } - } - - // set scaling factors - mkt.TradableInstrument.MarginCalculator.ScalingFactors = &proto.ScalingFactors{ - SearchLevel: search, - InitialMargin: initial, - CollateralRelease: release, - } - - // simple risk model: - if row.Cells[2].Value == "simple" { - mkt.TradableInstrument.RiskModel = &proto.TradableInstrument_SimpleRiskModel{ - SimpleRiskModel: &proto.SimpleRiskModel{ - Params: &proto.SimpleModelParams{ - FactorLong: tauLong, - FactorShort: lambdShort, - }, - }, - } - return - } - // for now, default to/assume future (forward risk model) - mu, _ := strconv.ParseFloat(row.Cells[5].Value, 64) - r, _ := strconv.ParseFloat(row.Cells[6].Value, 64) - sigma, _ := strconv.ParseFloat(row.Cells[7].Value, 64) - // No opening auction for now - //mkt.OpeningAuction.Duration = openAuctionDuration - mkt.TradableInstrument.RiskModel = &proto.TradableInstrument_LogNormalRiskModel{ - LogNormalRiskModel: &proto.LogNormalRiskModel{ - RiskAversionParameter: lambdShort, - Tau: tauLong, - Params: &proto.LogNormalModelParams{ - Mu: mu, - R: r, - Sigma: sigma, - }, - }, - } -} - -func theMarket(mSetup *gherkin.DataTable) error { - // generic market config, ready to be populated with specs from scenario - mkt := &proto.Market{ - Fees: &proto.Fees{ - Factors: &proto.FeeFactors{ - LiquidityFee: "0", - InfrastructureFee: "0", - MakerFee: "0", - }, - }, - TradableInstrument: &proto.TradableInstrument{ - Instrument: &proto.Instrument{ - Metadata: &proto.InstrumentMetadata{ - Tags: []string{ - "asset_class:fx/crypto", - "product:futures", - }, - }, - Product: &proto.Instrument_Future{ - Future: &proto.Future{ - Maturity: "2019-12-31T00:00:00Z", - OracleSpec: &oraclesv1.OracleSpec{ - PubKeys: []string{"0xDEADBEEF"}, - Filters: []*oraclesv1.Filter{ - { - Key: &oraclesv1.PropertyKey{ - Name: "prices.ETH.value", - Type: oraclesv1.PropertyKey_TYPE_INTEGER, - }, - Conditions: []*oraclesv1.Condition{}, - }, - }, - }, - OracleSpecBinding: &proto.OracleSpecToFutureBinding{ - SettlementPriceProperty: "prices.ETH.value", - }, - }, - }, - }, - MarginCalculator: &proto.MarginCalculator{}, - }, - // For now we won't have an opening auction - // OpeningAuction: &proto.AuctionDuration{}, - TradingModeConfig: &proto.Market_Continuous{ - Continuous: &proto.ContinuousTrading{}, - }, - PriceMonitoringSettings: &proto.PriceMonitoringSettings{ - Parameters: &proto.PriceMonitoringParameters{ - Triggers: []*proto.PriceMonitoringTrigger{}, - }, - UpdateFrequency: 0, - }, - TargetStakeParameters: &proto.TargetStakeParameters{ - TimeWindow: 3600, - ScalingFactor: 10, - }, - } - for _, row := range mSetup.Rows { - // skip header - if row.Cells[0].Value == "name" { - continue - } - initialiseMarket(row, mkt) - } - log := logging.NewTestLogger() - // the controller needs the reporter to report on errors or clunk out with fatal - mktsetup = getMarketTestSetup(mkt) - // create the party engine, and add to the test setup - // so we can register parties and their account balances - m, err := execution.NewMarket( - context.Background(), - log, - risk.NewDefaultConfig(), - positions.NewDefaultConfig(), - settlement.NewDefaultConfig(), - matching.NewDefaultConfig(), - fee.NewDefaultConfig(), - mktsetup.colE, - mktsetup.oracleEngine, - mkt, - time.Now(), - mktsetup.broker, - execution.NewIDGen(), - monitor.NewAuctionState(mkt, time.Now()), - ) - if err != nil { - return err - } - - _ = m.StartOpeningAuction(context.Background()) - mktsetup.core = m - core = m - return nil -} - -func theSystemAccounts(_ *gherkin.DataTable) error { - // we currently have N accounts, creating system accounts should create 2 more accounts - current := len(mktsetup.broker.GetAccounts()) - // this should create market accounts, currently same way it's done in execution engine (register market) - asset, _ := mktsetup.market.GetAsset() - _ = mktsetup.colE.EnableAsset(context.Background(), proto.Asset{ - Id: asset, - Symbol: asset, - }) - _, _, _ = mktsetup.colE.CreateMarketAccounts(context.Background(), mktsetup.core.GetID(), asset, 0) - if len(mktsetup.broker.GetAccounts()) != current+5 { - reporter.err = fmt.Errorf("error creating system accounts") - } - return reporter.err -} - -func tradersHaveTheFollowingState(traders *gherkin.DataTable) error { - // this is going to be tricky... we have no product set up, we can only ensure the trader accounts are created, but that's about it... - // damn... positions engine is not open here, let's just ram through the trades, and update the balances after the fact - market := core.GetID() - maxPos := 100 // ensure we can move 100 positions either long or short, doesn't really matter which way - for _, row := range traders.Rows { - // skip first row - if row.Cells[0].Value == "trader" { - continue - } - // it's safe to ignore this error for now - pos, err := strconv.Atoi(row.Cells[1].Value) - if err != nil { - return err - } - marginBal, err := strconv.ParseUint(row.Cells[2].Value, 10, 64) - if err != nil { - return err - } - generalBal, err := strconv.ParseUint(row.Cells[3].Value, 10, 64) - if err != nil { - return err - } - // highest net pos - if pos > maxPos { - maxPos = pos - } - asset, _ := mktsetup.market.GetAsset() - // get the account balance, ensure we can set the margin balance in this step if we want to - // and get the account ID's so we can keep track of the state correctly - general, _ := mktsetup.colE.CreatePartyGeneralAccount(context.Background(), row.Cells[0].Value, asset) - margin, _ := mktsetup.colE.CreatePartyMarginAccount(context.Background(), row.Cells[0].Value, market, asset) - _ = mktsetup.colE.IncrementBalance(context.Background(), margin, marginBal) - // add trader accounts to map - this is the state they should have now - mktsetup.traderAccs[row.Cells[0].Value] = map[proto.AccountType]*proto.Account{ - proto.AccountType_ACCOUNT_TYPE_MARGIN: { - Id: margin, - Type: proto.AccountType_ACCOUNT_TYPE_MARGIN, - Balance: marginBal, - }, - proto.AccountType_ACCOUNT_TYPE_GENERAL: { - Id: general, - Type: proto.AccountType_ACCOUNT_TYPE_GENERAL, - Balance: generalBal, - }, - } - trader := row.Cells[0].Value - // we should be able to safely ignore the error, if this fails, the tests will - _, _ = mktsetup.colE.Deposit(context.Background(), trader, asset, generalBal) - } - return nil -} - -func theFollowingOrders(orderT *gherkin.DataTable) error { - tomorrow := time.Now().Add(time.Hour * 24) - core := mktsetup.core - market := core.GetID() - calls := len(orderT.Rows) - // if the first row is a header row, exclude from the call count - if orderT.Rows[0].Cells[0].Value == "trader" { - calls-- - } - // build + place all orders - for _, row := range orderT.Rows { - if row.Cells[0].Value == "trader" { - continue - } - // else expect call to get party - // setup.parties.EXPECT().GetByID(row.Cells[0].Value).Times(1).Return( - // &proto.Party{ - // Id: row.Cells[0].Value, - // }, - // nil, - // ) - - side := proto.Side_SIDE_BUY - if row.Cells[1].Value == "sell" { - side = proto.Side_SIDE_SELL - } - vol, err := strconv.Atoi(row.Cells[2].Value) - if err != nil { - return err - } - price, err := strconv.ParseInt(row.Cells[3].Value, 10, 64) - if err != nil { - return err - } - expTrades, err := strconv.Atoi(row.Cells[4].Value) - if err != nil { - return err - } - order := proto.Order{ - Id: uuid.NewV4().String(), - MarketId: market, - PartyId: row.Cells[0].Value, - Side: side, - Price: uint64(price), - Size: uint64(vol), - Remaining: uint64(vol), - ExpiresAt: tomorrow.UnixNano(), - Type: proto.Order_TYPE_LIMIT, - TimeInForce: proto.Order_TIME_IN_FORCE_GTT, - CreatedAt: time.Now().UnixNano(), - } - result, err := core.SubmitOrder(context.TODO(), &order) - if err != nil { - return err - } - if len(result.Trades) != expTrades { - return fmt.Errorf("expected %d trades, instead saw %d (%#v)", expTrades, len(result.Trades), *result) - } - } - return nil -} - -func tradersLiability(liabilityTbl *gherkin.DataTable) error { - for _, row := range liabilityTbl.Rows { - // skip header - if row.Cells[0].Value == "trader" { - continue - } - trader := row.Cells[0].Value - margin, err := strconv.ParseUint(row.Cells[4].Value, 10, 64) - if err != nil { - return err - } - general, err := strconv.ParseUint(row.Cells[5].Value, 10, 64) - if err != nil { - return err - } - accounts := mktsetup.traderAccs[trader] - acc, err := mktsetup.colE.GetAccountByID(accounts[proto.AccountType_ACCOUNT_TYPE_MARGIN].Id) - if err != nil { - return err - } - // sync margin account state - mktsetup.traderAccs[trader][proto.AccountType_ACCOUNT_TYPE_MARGIN] = acc - if acc.Balance != margin { - return fmt.Errorf("expected %s margin account balance to be %d instead saw %d", trader, margin, acc.Balance) - } - acc, err = mktsetup.colE.GetAccountByID(accounts[proto.AccountType_ACCOUNT_TYPE_GENERAL].Id) - if err != nil { - return err - } - if acc.Balance != general { - return fmt.Errorf("expected %s general account balance to be %d, instead saw %d", trader, general, acc.Balance) - } - // sync general account state - mktsetup.traderAccs[trader][proto.AccountType_ACCOUNT_TYPE_GENERAL] = acc - } - return nil -} - -func hasNotBeenAddedToTheMarket(trader string) error { - accounts := mktsetup.traderAccs[trader] - acc, err := mktsetup.colE.GetAccountByID(accounts[proto.AccountType_ACCOUNT_TYPE_MARGIN].Id) - if err != nil || acc.Balance == 0 { - return nil - } - return fmt.Errorf("didn't expect %s to hava a margin account with balance, instead saw %d", trader, acc.Balance) -} - -func theMarkPriceIs(markPrice string) error { - price, _ := strconv.ParseUint(markPrice, 10, 64) - marketMarkPrice := mktsetup.core.GetMarketData().MarkPrice - if marketMarkPrice != price { - return fmt.Errorf("expected mark price of %d instead saw %d", price, marketMarkPrice) - } - - return nil -} diff --git a/integration/execution_layer_test.go b/integration/execution_layer_test.go index 33692d600d..6d797bd126 100644 --- a/integration/execution_layer_test.go +++ b/integration/execution_layer_test.go @@ -423,25 +423,6 @@ func tradersCancelsTheFollowingOrdersReference(refs *gherkin.DataTable) error { return nil } -func tradersCancelPeggedOrders(data *gherkin.DataTable) error { - for _, row := range data.Rows { - trader := val(row, 0) - if trader == "trader" { - continue - } - cancel := types.OrderCancellation{ - PartyId: trader, - MarketId: val(row, 1), - OrderId: val(row, 2), - } - _, err := execsetup.engine.CancelOrder(context.Background(), &cancel) - if err != nil { - return fmt.Errorf("unable to cancel order: %+v", err) - } - } - return nil -} - func tradersCancelPeggedOrdersAndClear(data *gherkin.DataTable) error { cancellations := make([]types.OrderCancellation, 0, len(data.Rows)) for _, row := range data.Rows { diff --git a/integration/features/1847-closeout-long.feature b/integration/features/1847-closeout-long.feature index 4ec00dce9a..49963d7ff3 100644 --- a/integration/features/1847-closeout-long.feature +++ b/integration/features/1847-closeout-long.feature @@ -50,8 +50,6 @@ Feature: Long close-out test (see ln 293 of system-tests/grpc/trading/tradesTest # then we make sure the insurance pool collected the funds And the insurance pool balance is "0" for the market "ETH/DEC19" - #Then dump orders - #check positions Then position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | diff --git a/integration/features/1847-closeout-short-with-fees.feature b/integration/features/1847-closeout-short-with-fees.feature index 2c50b856ae..1a2ce2bbf6 100644 --- a/integration/features/1847-closeout-short-with-fees.feature +++ b/integration/features/1847-closeout-short-with-fees.feature @@ -54,8 +54,6 @@ Feature: Long close-out test (see ln 449 of system-tests/grpc/trading/tradesTest # and only what's left (100+2-6=96) goes into the insurance pool. And the insurance pool balance is "96" for the market "ETH/DEC19" - #Then dump orders - #check positions # Note that the realisedPNL for tt_15 is -102 as additional 2 was made # on top of initial deposit by earning maker fee on passive orders. diff --git a/integration/features/1847-closeout-short.feature b/integration/features/1847-closeout-short.feature index 91e7208269..b9d3f11b75 100644 --- a/integration/features/1847-closeout-short.feature +++ b/integration/features/1847-closeout-short.feature @@ -49,8 +49,6 @@ Feature: Long close-out test (see ln 449 of system-tests/grpc/trading/tradesTest # then we make sure the insurance pool collected the funds And the insurance pool balance is "100" for the market "ETH/DEC19" - #Then dump orders - #check positions Then position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | diff --git a/integration/features/2943-distressed-trader-has-general-balance.feature b/integration/features/2943-distressed-trader-has-general-balance.feature index 838a677288..1fdfda8a49 100644 --- a/integration/features/2943-distressed-trader-has-general-balance.feature +++ b/integration/features/2943-distressed-trader-has-general-balance.feature @@ -49,16 +49,11 @@ Feature: Distressed traders should not have general balance left | trader | asset | id | margin | general | | trader4 | ETH | ETH/DEC20 | 360 | 9999999999640 | | trader5 | ETH | ETH/DEC20 | 372 | 9999999999628 | - # And clear order events And clear order events Then the trader submits LP: | id | party | market | commitment amount | fee | order side | order reference | order proportion | order offset | | lp1 | trader3 | ETH/DEC20 | 10000 | 0.1 | buy | BID | 10 | -10 | | lp1 | trader3 | ETH/DEC20 | 10000 | 0.1 | sell | ASK | 10 | 10 | - # | lp1 | trader3 | ETH/DEC20 | 10000 | 0.1 | sell | ASK | 10 | 50 | - # | lp1 | trader3 | ETH/DEC20 | 10000 | 0.1 | sell | ASK | 10 | 5 | - # | lp1 | trader3 | ETH/DEC20 | 10000 | 0.1 | sell | ASK | 10 | 75 | - # | lp1 | trader3 | ETH/DEC20 | 10000 | 0.1 | sell | MID | 10 | 75 | Then I see the LP events: | id | party | market | commitment amount | | lp1 | trader3 | ETH/DEC20 | 10000 | diff --git a/integration/features/2952-opening-auction-extension-csv.feature b/integration/features/2952-opening-auction-extension-csv.feature index 7df1f0ddb2..0eb43c8262 100644 --- a/integration/features/2952-opening-auction-extension-csv.feature +++ b/integration/features/2952-opening-auction-extension-csv.feature @@ -69,7 +69,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 1949413 | 993000587 | - # And dump transfers + # MTM loss + margin low And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -91,7 +91,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 2174316 | 990775684 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -112,7 +112,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 2399217 | 988550783 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -134,7 +134,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 2624120 | 986325880 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -157,7 +157,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 2174316 | 990775684 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -180,7 +180,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 1949413 | 993000587 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -203,7 +203,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 1836962 | 994113038 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -226,7 +226,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 1724511 | 995225489 | - # And dump transfers + # Check MTM Loss transfer happened And the following transfers happened: | from | to | fromType | toType | id | amount | asset | @@ -242,7 +242,7 @@ Feature: Set up a market, with an opening auction, then uncross the book Then I expect the trader to have a margin: | trader | asset | id | margin | general | | trader3 | ETH | ETH/DEC20 | 0 | 993900000 | - # And dump transfers + And the following transfers happened: | from | to | fromType | toType | id | amount | asset | | trader3 | market | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_FEES_MAKER | ETH/DEC20 | 40000 | ETH | diff --git a/integration/features/amend-order.feature b/integration/features/amend-order.feature index 8351d3842f..3377205bcd 100644 --- a/integration/features/amend-order.feature +++ b/integration/features/amend-order.feature @@ -58,8 +58,6 @@ Feature: Amend orders | trader | id | type | volume | price | resulting trades | type | tif | reference | | myboi3 | ETH/DEC19 | buy | 3 | 1 | 1 | TYPE_LIMIT | TIF_GTC | myboi-ref-3 | - -# Then the following trades happend Then the following trades happened: | buyer | seller | price | volume | | myboi3 | myboi | 1 | 3 | @@ -90,12 +88,9 @@ Feature: Amend orders Then traders place following orders with references: | trader | id | type | volume | price | resulting trades | type | tif | reference | | myboi3 | ETH/DEC19 | buy | 3 | 1 | 1 | TYPE_LIMIT | TIF_GTC | myboi-ref-3 | - - -# Then the following trades happend - Then the following trades happened: - | buyer | seller | price | volume | - | myboi3 | myboi2 | 1 | 3 | + Then the following trades happened: + | buyer | seller | price | volume | + | myboi3 | myboi2 | 1 | 3 | Scenario: Reduce size success and order cancelled as < to remaining # setup accounts diff --git a/integration/features/core.feature b/integration/features/core.feature deleted file mode 100644 index e22579b646..0000000000 --- a/integration/features/core.feature +++ /dev/null @@ -1,59 +0,0 @@ -Feature: Test trading-core flow with future risk model - - Background: - ## mark price will be set on instrument, given + data table - ## With these values, we get risk factors: - ## short=0.11000000665311127, long=0.10036253585651489 - Given the market: - | name | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | - | ETH/DEC19 | 1000 | future | 0.01 | 0.000114077 | 0 | 0 | 3.6907199 | 1.4 | 1.2 | 1.1 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | - And the system accounts: - | type | asset | balance | - | settlement | ETH | 0 | - | insurance | ETH | 0 | - And traders have the following state: - | trader | position | margin | general | asset | markprice | - | trader1 | 0 | 0 | 100000 | ETH | 1000 | - | trader2 | 0 | 0 | 100000 | ETH | 1000 | - | trader3 | 0 | 0 | 100000 | ETH | 1000 | - - Scenario: trader places unmatched order and creates a position. The margin balance is created - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 1010 | 0 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | 0 | 0 | 1 | 132 | 99868 | - And "trader2" has not been added to the market - And the mark price is "1000" - - Scenario: two traders place orders at different prices - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 1010 | 0 | - | trader2 | buy | 1 | 1005 | 0 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | 0 | 0 | 1 | 132 | 99868 | - | trader2 | 0 | 1 | 0 | 121 | 99879 | - And "trader3" has not been added to the market - And the mark price is "1000" - - Scenario: Three traders place orders, resulting in two trade - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 980 | 0 | - | trader1 | sell | 1 | 1020 | 0 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | 0 | 0 | 2 | 264 | 99736 | - When I place the following orders: - | trader | type | volume | price | resulting trades | - | trader2 | buy | 1 | 980 | 1 | - | trader3 | buy | 1 | 1020 | 1 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | -2 | 0 | 0 | 267 | 99693 | - | trader2 | 1 | 0 | 0 | 123 | 99917 | - | trader3 | 1 | 0 | 0 | 118 | 99882 | - And the mark price is "1020" diff --git a/integration/features/mark_to_mark_settlement_using_insurance_pool.feature b/integration/features/mark_to_mark_settlement_using_insurance_pool.feature index 8a8aa89f11..6e19a97637 100644 --- a/integration/features/mark_to_mark_settlement_using_insurance_pool.feature +++ b/integration/features/mark_to_mark_settlement_using_insurance_pool.feature @@ -52,8 +52,3 @@ Feature: Test mark to market settlement with insurance pool And All balances cumulated are worth "30121" And the settlement account balance is "0" for the market "ETH/DEC19" before MTM And the insurance pool balance is "5121" for the market "ETH/DEC19" - - # Then the following transfers happened: - # | from | to | fromType | toType | id | amount | asset | - # | trader1 | market | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_SETTLEMENT | ETH/DEC19 | 240 | ETH | - # And the settlement account balance is "0" for the market "ETH/DEC19" before MTM diff --git a/integration/features/market-depth-1.feature b/integration/features/market-depth-1.feature index e3c34222af..16f24f685f 100644 --- a/integration/features/market-depth-1.feature +++ b/integration/features/market-depth-1.feature @@ -2,7 +2,6 @@ Feature: Test market depth events for pegged orders Background: Given the insurance pool initial balance for the markets is "0": - # And the markets starts on "2019-11-30T00:00:00Z" and expires on "2019-12-31T23:59:59Z" And the execution engine have these markets: | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | @@ -32,7 +31,6 @@ Feature: Test market depth events for pegged orders | pegged1 | ETH/DEC19 | sell | 10 | MID | 10 | 100 | | pegged2 | ETH/DEC19 | buy | 5 | MID | -15 | 100 | | pegged3 | ETH/DEC19 | buy | 5 | MID | -10 | 100 | -# And dump orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | pegged1 | ETH/DEC19 | sell | 10 | MID | 10 | 100 | STATUS_PARKED | @@ -44,7 +42,6 @@ Feature: Test market depth events for pegged orders | trader | id | type | volume | price | resulting trades | type | tif | reference | | sellSideProvider | ETH/DEC19 | sell | 1000 | 120 | 0 | TYPE_LIMIT | TIF_GTC | sell-provider-1 | | buySideProvider | ETH/DEC19 | buy | 1000 | 80 | 0 | TYPE_LIMIT | TIF_GTC | buy-provider-1 | -# And dump orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | sellSideProvider | ETH/DEC19 | sell | 1000 | | 0 | 120 | STATUS_ACTIVE | @@ -54,7 +51,6 @@ Feature: Test market depth events for pegged orders | trader | reference | | sellSideProvider | sell-provider-1 | | buySideProvider | buy-provider-1 | -# And dump orders # Now check what happened to our pegged orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | diff --git a/integration/features/market-depth-2.feature b/integration/features/market-depth-2.feature index 171a111b82..7c5f5e3f60 100644 --- a/integration/features/market-depth-2.feature +++ b/integration/features/market-depth-2.feature @@ -2,7 +2,6 @@ Feature: Test market depth events for pegged orders Background: Given the insurance pool initial balance for the markets is "0": - # And the markets starts on "2019-11-30T00:00:00Z" and expires on "2019-12-31T23:59:59Z" And the execution engine have these markets: | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | @@ -32,7 +31,7 @@ Feature: Test market depth events for pegged orders | pegged1 | ETH/DEC19 | sell | 1000 | MID | 10 | 100 | | pegged2 | ETH/DEC19 | buy | 500 | MID | -15 | 100 | | pegged3 | ETH/DEC19 | buy | 500 | MID | -10 | 100 | -# And dump orders + Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | pegged1 | ETH/DEC19 | sell | 1000 | MID | 10 | 100 | STATUS_PARKED | @@ -45,7 +44,7 @@ Feature: Test market depth events for pegged orders | trader | id | type | volume | price | resulting trades | type | tif | reference | | sellSideProvider | ETH/DEC19 | sell | 1000 | 120 | 0 | TYPE_LIMIT | TIF_GTC | sell-provider-1 | | buySideProvider | ETH/DEC19 | buy | 1000 | 80 | 0 | TYPE_LIMIT | TIF_GTC | buy-provider-1 | -# And dump orders + Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | sellSideProvider | ETH/DEC19 | sell | 1000 | | 0 | 120 | STATUS_ACTIVE | @@ -55,7 +54,7 @@ Feature: Test market depth events for pegged orders | trader | reference | | sellSideProvider | sell-provider-1 | | buySideProvider | buy-provider-1 | -# And dump orders + # Now check what happened to our pegged orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | diff --git a/integration/features/market-depth-3.feature b/integration/features/market-depth-3.feature index 7b88450394..16559f8d30 100644 --- a/integration/features/market-depth-3.feature +++ b/integration/features/market-depth-3.feature @@ -2,7 +2,6 @@ Feature: Test market depth events for pegged orders (with BID and ASK price) Background: Given the insurance pool initial balance for the markets is "0": - # And the markets starts on "2019-11-30T00:00:00Z" and expires on "2019-12-31T23:59:59Z" And the execution engine have these markets: | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | @@ -35,7 +34,6 @@ Feature: Test market depth events for pegged orders (with BID and ASK price) | pegged2 | ETH/DEC19 | sell | 5 | MID | 15 | 100 | | pegged3 | ETH/DEC19 | buy | 5 | BID | -10 | 100 | | pegged4 | ETH/DEC19 | buy | 5 | MID | -10 | 100 | -# And dump orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | pegged1 | ETH/DEC19 | sell | 5 | ASK | 10 | 100 | STATUS_PARKED | @@ -48,7 +46,6 @@ Feature: Test market depth events for pegged orders (with BID and ASK price) | trader | id | type | volume | price | resulting trades | type | tif | reference | | sellSideProvider | ETH/DEC19 | sell | 1000 | 120 | 0 | TYPE_LIMIT | TIF_GTC | sell-provider-1 | | buySideProvider | ETH/DEC19 | buy | 1000 | 80 | 0 | TYPE_LIMIT | TIF_GTC | buy-provider-1 | -# And dump orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | sellSideProvider | ETH/DEC19 | sell | 1000 | | 0 | 120 | STATUS_ACTIVE | @@ -58,7 +55,6 @@ Feature: Test market depth events for pegged orders (with BID and ASK price) | trader | reference | | sellSideProvider | sell-provider-1 | | buySideProvider | buy-provider-1 | -# And dump orders # Now check what happened to our pegged orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | diff --git a/integration/features/market-depth-4.feature b/integration/features/market-depth-4.feature index 3750c24a95..2a8110a560 100644 --- a/integration/features/market-depth-4.feature +++ b/integration/features/market-depth-4.feature @@ -2,7 +2,7 @@ Feature: Test market depth events for pegged orders (cancelling pegged orders) Background: Given the insurance pool initial balance for the markets is "0": - # And the markets starts on "2019-11-30T00:00:00Z" and expires on "2019-12-31T23:59:59Z" + And the execution engine have these markets: | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | @@ -35,7 +35,7 @@ Feature: Test market depth events for pegged orders (cancelling pegged orders) | pegged2 | ETH/DEC19 | sell | 500 | MID | 15 | 100 | | pegged3 | ETH/DEC19 | buy | 500 | BID | -10 | 100 | | pegged4 | ETH/DEC19 | buy | 500 | MID | -10 | 100 | -# And dump orders + Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | pegged1 | ETH/DEC19 | sell | 500 | ASK | 10 | 100 | STATUS_PARKED | @@ -49,7 +49,7 @@ Feature: Test market depth events for pegged orders (cancelling pegged orders) | trader | id | type | volume | price | resulting trades | type | tif | reference | | sellSideProvider | ETH/DEC19 | sell | 1000 | 120 | 0 | TYPE_LIMIT | TIF_GTC | sell-provider-1 | | buySideProvider | ETH/DEC19 | buy | 1000 | 80 | 0 | TYPE_LIMIT | TIF_GTC | buy-provider-1 | -# And dump orders + Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | sellSideProvider | ETH/DEC19 | sell | 1000 | | 0 | 120 | STATUS_ACTIVE | @@ -59,7 +59,7 @@ Feature: Test market depth events for pegged orders (cancelling pegged orders) | trader | reference | | sellSideProvider | sell-provider-1 | | buySideProvider | buy-provider-1 | -# And dump orders + # Now check what happened to our pegged orders Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | @@ -75,10 +75,10 @@ Feature: Test market depth events for pegged orders (cancelling pegged orders) | pegged1 | ETH/DEC19 | | pegged3 | ETH/DEC19 | | pegged2 | ETH/DEC19 | -# And dump orders + Then I see the following order events: | trader | id | side | volume | reference | offset | price | status | | pegged3 | ETH/DEC19 | buy | 500 | BID | -10 | 70 | STATUS_CANCELLED | | pegged1 | ETH/DEC19 | sell | 500 | ASK | 10 | 130 | STATUS_CANCELLED | | pegged2 | ETH/DEC19 | sell | 500 | MID | 15 | 115 | STATUS_CANCELLED | -# And dump orders + diff --git a/integration/features/simple.feature b/integration/features/simple.feature deleted file mode 100644 index 30856998bd..0000000000 --- a/integration/features/simple.feature +++ /dev/null @@ -1,68 +0,0 @@ -Feature: Test trading-core flow with simple risk model - - Background: - Given the market: - | name | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | - | ETH/DEC19 | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | - And the system accounts: - | type | asset | balance | - | settlement | ETH | 0 | - | insurance | ETH | 0 | - And traders have the following state: - | trader | position | margin | general | asset | markprice | - | trader1 | 0 | 0 | 100000 | ETH | 1000 | - | trader2 | 0 | 0 | 100000 | ETH | 1000 | - | trader3 | 0 | 0 | 100000 | ETH | 1000 | - - Scenario: trader places unmatched order and creates a position. The margin balance is created - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 1010 | 0 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | 0 | 0 | 1 | 132 | 99868 | - And "trader2" has not been added to the market - And the mark price is "1000" - - Scenario: two traders place orders at different prices, lower buy price (no trade is created) - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 1010 | 0 | - | trader2 | buy | 1 | 1005 | 0 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | 0 | 0 | 1 | 132 | 99868 | - | trader2 | 0 | 1 | 0 | 120 | 99880 | - And "trader3" has not been added to the market - And the mark price is "1000" - - Scenario: Three traders place orders, resulting in two trade - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 980 | 0 | - | trader1 | sell | 1 | 1020 | 0 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | 0 | 0 | 2 | 264 | 99736 | - When I place the following orders: - | trader | type | volume | price | resulting trades | - | trader2 | buy | 1 | 980 | 1 | - | trader3 | buy | 1 | 1020 | 1 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | -2 | 0 | 0 | 267 | 99693 | - | trader2 | 1 | 0 | 0 | 122 | 99918 | - | trader3 | 1 | 0 | 0 | 117 | 99883 | - And the mark price is "1020" - - Scenario: two traders place orders at different prices, with a higher buy price (creates trade) - Given the following orders: - | trader | type | volume | price | resulting trades | - | trader1 | sell | 1 | 1010 | 0 | - | trader2 | buy | 1 | 1012 | 1 | - Then I expect the trader to have a margin liability: - | trader | position | buy | sell | margin | general | - | trader1 | -1 | 0 | 0 | 132 | 99868 | - | trader2 | 1 | 0 | 0 | 120 | 99880 | - And "trader3" has not been added to the market - And the mark price is "1010" diff --git a/integration/features/verified-loss-socialization-case1.feature b/integration/features/verified-loss-socialization-case1.feature index 98b25bfad0..0e2abfacd8 100644 --- a/integration/features/verified-loss-socialization-case1.feature +++ b/integration/features/verified-loss-socialization-case1.feature @@ -2,7 +2,7 @@ Feature: Test loss socialization case 1 Background: Given the insurance pool initial balance for the markets is "0": - # And the markets starts on "2019-11-30T00:00:00Z" and expires on "2019-12-31T23:59:59Z" + And the execution engine have these markets: | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | diff --git a/integration/main_test.go b/integration/main_test.go index bd284869c4..8304c34650 100644 --- a/integration/main_test.go +++ b/integration/main_test.go @@ -14,7 +14,6 @@ var ( gdOpts = godog.Options{ Output: colors.Colored(os.Stdout), Format: "progress", - // Format: "pretty", // default to pretty output so we can diagnose failed CI builds more easily } ) @@ -62,15 +61,6 @@ func FeatureContext(s *godog.Suite) { s.Step(`^the following traders:$`, theFollowingTraders) s.Step(`^I Expect the traders to have new general account:$`, iExpectTheTradersToHaveNewGeneralAccount) s.Step(`^"([^"]*)" general accounts balance is "([^"]*)"$`, generalAccountsBalanceIs) - - s.Step(`^the market:$`, theMarket) - s.Step(`^the system accounts:$`, theSystemAccounts) - s.Step(`^traders have the following state:$`, tradersHaveTheFollowingState) - s.Step(`^the following orders:$`, theFollowingOrders) - s.Step(`^I place the following orders:$`, theFollowingOrders) - s.Step(`^I expect the trader to have a margin liability:$`, tradersLiability) - s.Step(`^"([^"]*)" has not been added to the market$`, hasNotBeenAddedToTheMarket) - s.Step(`^the mark price is "([^"]+)"$`, theMarkPriceIs) s.Step(`^the execution engine have these markets:$`, theExecutionEngineHaveTheseMarkets) s.Step(`^traders place following orders:$`, tradersPlaceFollowingOrders) s.Step(`^I expect the trader to have a margin:$`, iExpectTheTraderToHaveAMargin) @@ -105,7 +95,6 @@ func FeatureContext(s *godog.Suite) { s.Step(`^I see the following order events:$`, seeTheFollowingOrderEvents) s.Step(`^clear order events by reference:$`, clearOrdersByRef) s.Step(`^clear transfer events$`, clearTransferEvents) - s.Step(`^traders cancel pegged orders:$`, tradersCancelPeggedOrders) s.Step(`^traders cancel pegged orders and clear:$`, tradersCancelPeggedOrdersAndClear) s.Step(`^the trader submits LP:$`, submitLP) s.Step(`^I see the LP events:$`, seeLPEvents) diff --git a/integration/setup_test.go b/integration/setup_test.go index cbc31e712d..06b0577331 100644 --- a/integration/setup_test.go +++ b/integration/setup_test.go @@ -22,7 +22,6 @@ const ( ) var ( - mktsetup *marketTestSetup execsetup *executionTestSetup reporter tstReporter @@ -44,77 +43,6 @@ func (t tstReporter) Fatalf(format string, args ...interface{}) { os.Exit(1) } -type marketTestSetup struct { - market *types.Market - ctrl *gomock.Controller - core *execution.Market - - // accounts *cmocks.MockAccountBuffer - accountIDs map[string]struct{} - traderAccs map[string]map[types.AccountType]*types.Account - - // we need to call this engine directly - colE *collateral.Engine - oracleEngine *oracles.Engine - broker *brokerStub -} - -func getMarketTestSetup(market *types.Market) *marketTestSetup { - log := logging.NewTestLogger() - - if mktsetup != nil { - mktsetup.ctrl.Finish() - mktsetup = nil // ready for GC - } - // the controller needs the reporter to report on errors or clunk out with fatal - ctrl := gomock.NewController(&reporter) - broker := NewBrokerStub() - - // this can happen any number of times, just set the mock up to accept all of them - // Over time, these mocks will be replaced with stubs that store all elements to a map - // again: allow all calls, replace with stub over time - currentTime := time.Now() - colE, _ := collateral.New( - log, - collateral.NewDefaultConfig(), - broker, - currentTime, - ) - - oracleEngine := oracles.NewEngine(log, oracles.NewDefaultConfig(), currentTime, broker) - - tokAsset := types.Asset{ - Id: "VOTE", - Name: "VOTE", - Symbol: "VOTE", - Decimals: 5, - TotalSupply: "1000", - Source: &types.AssetSource{ - Source: &types.AssetSource_BuiltinAsset{ - BuiltinAsset: &types.BuiltinAsset{ - Name: "VOTE", - Symbol: "VOTE", - Decimals: 5, - TotalSupply: "1000", - }, - }, - }, - } - _ = colE.EnableAsset(context.Background(), tokAsset) - - setup := &marketTestSetup{ - market: market, - ctrl: ctrl, - accountIDs: map[string]struct{}{}, - traderAccs: map[string]map[types.AccountType]*types.Account{}, - colE: colE, - oracleEngine: oracleEngine, - broker: broker, - } - - return setup -} - type executionTestSetup struct { engine *execution.Engine @@ -122,8 +50,6 @@ type executionTestSetup struct { log *logging.Logger ctrl *gomock.Controller timesvc *timeStub - proposal *ProposalStub - votes *VoteStub collateral *collateral.Engine oracleEngine *oracles.Engine @@ -161,8 +87,6 @@ func getExecutionTestSetup(startTime time.Time, mkts []types.Market) *executionT execsetup.accs = map[string][]account{} execsetup.mkts = mkts execsetup.timesvc = &timeStub{now: startTime} - execsetup.proposal = NewProposalStub() - execsetup.votes = NewVoteStub() execsetup.broker = NewBrokerStub() currentTime := time.Now() execsetup.collateral, _ = collateral.New( @@ -172,7 +96,7 @@ func getExecutionTestSetup(startTime time.Time, mkts []types.Market) *executionT for _, mkt := range mkts { asset, _ := mkt.GetAsset() - _ = execsetup.collateral.EnableAsset(context.Background(), types.Asset{ + execsetup.collateral.EnableAsset(context.Background(), types.Asset{ Id: asset, Symbol: asset, }) @@ -195,7 +119,7 @@ func getExecutionTestSetup(startTime time.Time, mkts []types.Market) *executionT }, }, } - _ = execsetup.collateral.EnableAsset(context.Background(), tokAsset) + execsetup.collateral.EnableAsset(context.Background(), tokAsset) execsetup.engine = execution.NewEngine( execsetup.log, @@ -208,7 +132,7 @@ func getExecutionTestSetup(startTime time.Time, mkts []types.Market) *executionT for _, mkt := range mkts { mkt := mkt - _ = execsetup.engine.SubmitMarket(context.Background(), &mkt) + execsetup.engine.SubmitMarket(context.Background(), &mkt) } // instantiate position plugin From 52a7471b8a452b4998943ea1e99881fd098c3315 Mon Sep 17 00:00:00 2001 From: Valentin Trinque Date: Fri, 5 Mar 2021 17:37:14 +0100 Subject: [PATCH 2/3] Add generic table wraper for gherkin --- integration/table_wrapper_test.go | 113 ++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 integration/table_wrapper_test.go diff --git a/integration/table_wrapper_test.go b/integration/table_wrapper_test.go new file mode 100644 index 0000000000..6d8728fc36 --- /dev/null +++ b/integration/table_wrapper_test.go @@ -0,0 +1,113 @@ +package core_test + +import ( + "fmt" + "strconv" + "strings" + + "github.com/cucumber/godog/gherkin" +) + +type TableWrapper gherkin.DataTable + +func (t TableWrapper) Parse() []RowWrapper { + dt := gherkin.DataTable(t) + out := make([]RowWrapper, 0, len(dt.Rows)-1) + + for _, row := range dt.Rows[1:] { + wrapper := RowWrapper{values: map[string]string{}} + for i := range row.Cells { + wrapper.values[dt.Rows[0].Cells[i].Value] = row.Cells[i].Value + } + out = append(out, wrapper) + } + + return out +} + +type RowWrapper struct { + values map[string]string +} + +func (r RowWrapper) Str(name string) string { + return r.values[name] +} + +func (r RowWrapper) U64(name string) (uint64, error) { + rawValue := r.values[name] + return strconv.ParseUint(rawValue, 10, 0) +} + +func (r RowWrapper) U64Slice(name, sep string) ([]uint64, error) { + rawValue := r.values[name] + if len(rawValue) == 0 { + return []uint64{}, nil + } + rawValues := strings.Split(rawValue, sep) + valuesCount := len(rawValues) + array := make([]uint64, 0, valuesCount) + for i := 0; i < valuesCount; i++ { + item, err := strconv.ParseUint(rawValues[i], 10, 0) + if err != nil { + return nil, err + } + array = append(array, item) + } + return array, nil +} + +func (r RowWrapper) I64(name string) (int64, error) { + rawValue := r.values[name] + return strconv.ParseInt(rawValue, 10, 0) +} + +func (r RowWrapper) I64Slice(name, sep string) ([]int64, error) { + rawValue := r.values[name] + if len(rawValue) == 0 { + return []int64{}, nil + } + rawValues := strings.Split(rawValue, sep) + valuesCount := len(rawValues) + array := make([]int64, 0, valuesCount) + for i := 0; i < valuesCount; i++ { + item, err := strconv.ParseInt(rawValues[i], 10, 0) + if err != nil { + return nil, err + } + array = append(array, item) + } + return array, nil +} + +func (r RowWrapper) F64(name string) (float64, error) { + rawValue := r.values[name] + return strconv.ParseFloat(rawValue, 10) +} + +func (r RowWrapper) F64Slice(name, sep string) ([]float64, error) { + rawValue := r.values[name] + if len(rawValue) == 0 { + return nil, nil + } + rawValues := strings.Split(rawValue, sep) + valuesCount := len(rawValues) + array := make([]float64, 0, valuesCount) + for i := 0; i < valuesCount; i++ { + item, err := strconv.ParseFloat(rawValues[i], 10) + if err != nil { + return nil, err + } + array = append(array, item) + } + return array, nil +} + +func (r RowWrapper) Bool(name string) (bool, error) { + rawValue := r.values[name] + if rawValue == "true" { + return true, nil + } else if rawValue == "false" { + return false, nil + } + return false, fmt.Errorf("invalid bool value: %v", name) +} From ccd764cb3e5bb68e252e961c8a1b4577cf871ff1 Mon Sep 17 00:00:00 2001 From: Valentin Trinque Date: Mon, 8 Mar 2021 14:49:36 +0100 Subject: [PATCH 3/3] Cleaner and uniform market declaration in feature tests We were using indexes to iterate through the table, which required to update all the indexes when adding or removing a column. To ease the maintenance of suche table, we introduce a generic layer to get the column by name, with appropriate type conversion. This makes us switch from the indexes to column name. To makes things even clearer, we add a specific layer on top of the generic one and abstract away column names into accessors. Doing so requires us to uniformize the column name across all tests, which is a good thing. --- integration/README.md | 2 +- integration/execution_layer_test.go | 172 +-------- .../1779-cannot-place-network-order.feature | 6 +- .../1847-closeout-long-with-fees.feature | 4 +- .../features/1847-closeout-long.feature | 4 +- .../1847-closeout-short-with-fees.feature | 4 +- .../features/1847-closeout-short.feature | 4 +- ...close-out-occurs-above-maintenance.feature | 4 +- ...d-stopped-fok-should-have-0-margin.feature | 6 +- .../features/2668-price-monitoring.feature | 6 +- .../features/2681-price-monitoring.feature | 6 +- ...tressed-trader-has-general-balance.feature | 6 +- ...2952-opening-auction-extension-csv.feature | 4 +- .../2952-opening-auction-uncrossing.feature | 4 +- ...-money-sitting-in-a-margin-account.feature | 6 +- ...ero-after-trading-out-market-order.feature | 6 +- ...598-open-position-with-zero-margin.feature | 6 +- .../614-margin-calculations-fixes.feature | 4 +- ...resolution-negative-insurance-pool.feature | 6 +- .../features/635-margin-calculation.feature | 6 +- .../features/760_cancel_filled_order.feature | 6 +- .../762_missing_party_and_order.feature | 6 +- .../features/767-margin-level-check.feature | 6 +- integration/features/amend-order.feature | 6 +- .../features/building_trader_accounts.feature | 8 +- .../ensure-funds-are-released.feature | 6 +- .../liquidity_provision_simple.feature | 7 +- integration/features/margins.feature | 6 +- ...rk_settlement_using_insurance_pool.feature | 6 +- .../mark_to_market_settlement.feature | 6 +- integration/features/market-depth-1.feature | 6 +- integration/features/market-depth-2.feature | 6 +- integration/features/market-depth-3.feature | 6 +- integration/features/market-depth-4.feature | 6 +- .../network-order-and-trades-sub.feature | 6 +- .../features/opening-auction-uncross.feature | 4 +- .../price-monitoring-for-system-test.feature | 6 +- .../price-monitoring-lognormal.feature | 6 +- .../price-monitoring-lognormal2.feature | 6 +- .../features/price-monitoring-simple.feature | 6 +- .../features/settlement_at_expiry.feature | 6 +- .../verified-loss-socialization-case1.feature | 6 +- .../verified-loss-socialization-case2.feature | 6 +- .../verified-loss-socialization-case3.feature | 6 +- .../verified-loss-socialization-case4.feature | 6 +- .../verified-loss-socialization-case5.feature | 6 +- ...verified-mark-to-market-settlement.feature | 6 +- .../verified-positions-resolution-1.feature | 6 +- .../verified-positions-resolution-2.feature | 6 +- .../verified-positions-resolution-3.feature | 6 +- .../verified-positions-resolution-4.feature | 6 +- .../features/verified_margins_case1.feature | 24 +- .../features/verified_margins_case2.feature | 24 +- .../features/verified_margins_case3.feature | 20 +- .../features/verified_margins_case4.feature | 20 +- .../features/verified_margins_case5.feature | 24 +- integration/gherkin_test.go | 55 +-- integration/main_test.go | 2 +- integration/market_step_test.go | 355 ++++++++++++++++++ integration/table_wrapper_test.go | 4 + 60 files changed, 566 insertions(+), 415 deletions(-) create mode 100644 integration/market_step_test.go diff --git a/integration/README.md b/integration/README.md index 5ac94523b8..c1fd4e0686 100644 --- a/integration/README.md +++ b/integration/README.md @@ -66,6 +66,6 @@ Feature: A feature that reproduces some system test Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | | ETH/DEC20 | ETH | ETH | ETH | 100 | simple | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0.004 | 0.001 | 0.3 | 0 | | | | 0.1 | ``` diff --git a/integration/execution_layer_test.go b/integration/execution_layer_test.go index 6d797bd126..b0313ffb19 100644 --- a/integration/execution_layer_test.go +++ b/integration/execution_layer_test.go @@ -4,15 +4,12 @@ import ( "context" "errors" "fmt" - "log" "strconv" - "strings" "time" "code.vegaprotocol.io/vega/events" "code.vegaprotocol.io/vega/oracles" types "code.vegaprotocol.io/vega/proto" - oraclesv1 "code.vegaprotocol.io/vega/proto/oracles/v1" "github.com/cucumber/godog/gherkin" uuid "github.com/satori/go.uuid" @@ -39,26 +36,6 @@ func theInsurancePoolInitialBalanceForTheMarketsIs(amountstr string) error { return nil } -func theExecutionEngineHaveTheseMarkets(arg1 *gherkin.DataTable) error { - mkts := []types.Market{} - for _, row := range arg1.Rows { - if val(row, 0) == "name" { - continue - } - mkt := baseMarket(row) - mkts = append(mkts, mkt) - } - - t, _ := time.Parse("2006-01-02T15:04:05Z", marketStart) - execsetup = getExecutionTestSetup(t, mkts) - - // reset market start time and expiry for next run - marketExpiry = defaultMarketExpiry - marketStart = defaultMarketStart - - return nil -} - func theFollowingTraders(arg1 *gherkin.DataTable) error { // create the trader from the table using NotifyTraderAccount for _, row := range arg1.Rows { @@ -188,7 +165,9 @@ func generalAccountForAssetBalanceIs(trader, asset, balancestr string) error { } if acc.Balance != balance { - return fmt.Errorf("invalid general asset=%v account balance=%v for trader=%v", asset, acc.Balance, trader) + return fmt.Errorf("invalid general account balance for asset(%s) for trader(%s), expected(%d) got(%d)", + asset, trader, balance, acc.Balance, + ) } return nil @@ -534,10 +513,12 @@ func theFollowingTransfersHappened(arg1 *gherkin.DataTable) error { data = append(data, e.TransferResponses()...) } + var foundButNotMatched uint64 for _, v := range data { for _, _v := range v.GetTransfers() { if _v.FromAccount == fromAccountID && _v.ToAccount == toAccountID { if _v.Amount != u64val(row, 5) { + foundButNotMatched = _v.Amount continue } ledgerEntry = _v @@ -550,7 +531,9 @@ func theFollowingTransfersHappened(arg1 *gherkin.DataTable) error { } if ledgerEntry == nil { - return fmt.Errorf("missing transfers between %v and %v for amount %v", fromAccountID, toAccountID, i64val(row, 5)) + return fmt.Errorf("missing transfers between %v and %v for amount %v, found %v", + fromAccountID, toAccountID, i64val(row, 5), foundButNotMatched, + ) } if ledgerEntry.Amount != u64val(row, 5) { return fmt.Errorf("invalid amount transfer %v and %v", ledgerEntry.Amount, i64val(row, 5)) @@ -970,145 +953,6 @@ func accountID(marketID, partyID, asset string, _ty int32) string { return string(idbuf[:ln+1]) } -func baseMarket(row *gherkin.TableRow) types.Market { - horizons, err := i64arr(row, 21, ",") - if err != nil { - log.Fatalf("Can't parse horizons (%v) to int64 array: %v", row.Cells[21].Value, err) - } - probs, err := f64arr(row, 22, ",") - if err != nil { - log.Fatalf("Can't parse probabilities (%v) to float64 array: %v", row.Cells[22].Value, err) - } - durations, err := i64arr(row, 23, ",") - if err != nil { - log.Fatalf("Can't parse durations (%v) to int64 array: %v", row.Cells[23].Value, err) - } - n := len(horizons) - if n != len(probs) || n != len(durations) { - log.Fatalf("horizons (%v), probabilities (%v) and durations (%v) need to have the same number of elements", - n, - len(probs), - len(durations)) - } - - triggs := make([]*types.PriceMonitoringTrigger, 0, n) - for i := 0; i < n; i++ { - p := &types.PriceMonitoringTrigger{Horizon: horizons[i], Probability: probs[i], AuctionExtension: durations[i]} - triggs = append(triggs, p) - } - pMonitorSettings := &types.PriceMonitoringSettings{ - Parameters: &types.PriceMonitoringParameters{ - Triggers: triggs, - }, - UpdateFrequency: i64val(row, 20), - } - - openingAuction := &types.AuctionDuration{ - Duration: i64val(row, 15), - } - - if openingAuction.Duration <= 0 { - openingAuction = nil - } - - oracleSpecPropertyType, err := oracleSpecPropertyTypeVal(row, 27) - if err != nil { - log.Fatalf("Can't parse oracleSpecPropertyType %v to PropertyKey_Type: %v", row.Cells[27].Value, err) - } - - mkt := types.Market{ - TradingMode: types.Market_TRADING_MODE_CONTINUOUS, - State: types.Market_STATE_ACTIVE, - Id: val(row, 0), - DecimalPlaces: 2, - Fees: &types.Fees{ - Factors: &types.FeeFactors{ - LiquidityFee: val(row, 19), - InfrastructureFee: val(row, 18), - MakerFee: val(row, 17), - }, - }, - TradableInstrument: &types.TradableInstrument{ - Instrument: &types.Instrument{ - Id: fmt.Sprintf("Crypto/%s/Futures", val(row, 0)), - Code: fmt.Sprintf("CRYPTO/%v", val(row, 0)), - Name: fmt.Sprintf("%s future", val(row, 0)), - Metadata: &types.InstrumentMetadata{ - Tags: []string{ - "asset_class:fx/crypto", - "product:futures", - }, - }, - InitialMarkPrice: u64val(row, 4), - Product: &types.Instrument_Future{ - Future: &types.Future{ - Maturity: marketExpiry, - SettlementAsset: val(row, 3), - QuoteName: val(row, 2), - OracleSpec: &oraclesv1.OracleSpec{ - PubKeys: strings.Split(val(row, 25), ","), - Filters: []*oraclesv1.Filter{ - { - Key: &oraclesv1.PropertyKey{ - Name: val(row, 26), - Type: oracleSpecPropertyType, - }, - Conditions: []*oraclesv1.Condition{}, - }, - }, - }, - OracleSpecBinding: &types.OracleSpecToFutureBinding{ - SettlementPriceProperty: val(row, 28), - }, - }, - }, - }, - RiskModel: &types.TradableInstrument_SimpleRiskModel{ - SimpleRiskModel: &types.SimpleRiskModel{ - Params: &types.SimpleModelParams{ - FactorLong: f64val(row, 6), - FactorShort: f64val(row, 7), - MaxMoveUp: f64val(row, 8), - MinMoveDown: f64val(row, 9), - ProbabilityOfTrading: f64val(row, 24), - }, - }, - }, - MarginCalculator: &types.MarginCalculator{ - ScalingFactors: &types.ScalingFactors{ - SearchLevel: f64val(row, 13), - InitialMargin: f64val(row, 12), - CollateralRelease: f64val(row, 11), - }, - }, - }, - OpeningAuction: openingAuction, - TradingModeConfig: &types.Market_Continuous{ - Continuous: &types.ContinuousTrading{}, - }, - PriceMonitoringSettings: pMonitorSettings, - TargetStakeParameters: &types.TargetStakeParameters{ - TimeWindow: 3600, - ScalingFactor: 10, - }, - } - if val(row, 5) == "forward" { - mkt.TradableInstrument.RiskModel = &types.TradableInstrument_LogNormalRiskModel{ - LogNormalRiskModel: &types.LogNormalRiskModel{ - RiskAversionParameter: f64val(row, 6), // 6 - Tau: f64val(row, 7), // 7 - Params: &types.LogNormalModelParams{ - Mu: f64val(row, 8), // 8 - R: f64val(row, 9), // 9 - Sigma: f64val(row, 10), //10 - }, - }, - } - } - - return mkt -} - func executedTrades(trades *gherkin.DataTable) error { var err error for i, row := range trades.Rows { diff --git a/integration/features/1779-cannot-place-network-order.feature b/integration/features/1779-cannot-place-network-order.feature index 7e20694221..da42ae9853 100644 --- a/integration/features/1779-cannot-place-network-order.feature +++ b/integration/features/1779-cannot-place-network-order.feature @@ -3,11 +3,11 @@ Feature: Cannot place an network order Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: an order is rejected if a trader try to place an order with type NETWORK Given the following traders: diff --git a/integration/features/1847-closeout-long-with-fees.feature b/integration/features/1847-closeout-long-with-fees.feature index fa14260a9c..3c636f4d56 100644 --- a/integration/features/1847-closeout-long-with-fees.feature +++ b/integration/features/1847-closeout-long-with-fees.feature @@ -3,8 +3,8 @@ Feature: Long close-out test (see ln 293 of system-tests/grpc/trading/tradesTest Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0.00025 | 0.0005 | 0.001 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0.00025 | 0.0005 | 0.001 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/1847-closeout-long.feature b/integration/features/1847-closeout-long.feature index 49963d7ff3..181e7c3a3c 100644 --- a/integration/features/1847-closeout-long.feature +++ b/integration/features/1847-closeout-long.feature @@ -3,8 +3,8 @@ Feature: Long close-out test (see ln 293 of system-tests/grpc/trading/tradesTest Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/1847-closeout-short-with-fees.feature b/integration/features/1847-closeout-short-with-fees.feature index 1a2ce2bbf6..1617c91ae3 100644 --- a/integration/features/1847-closeout-short-with-fees.feature +++ b/integration/features/1847-closeout-short-with-fees.feature @@ -3,8 +3,8 @@ Feature: Long close-out test (see ln 449 of system-tests/grpc/trading/tradesTest Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0.00025 | 0.0005 | 0.001 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0.00025 | 0.0005 | 0.001 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/1847-closeout-short.feature b/integration/features/1847-closeout-short.feature index b9d3f11b75..41b48f7620 100644 --- a/integration/features/1847-closeout-short.feature +++ b/integration/features/1847-closeout-short.feature @@ -3,8 +3,8 @@ Feature: Long close-out test (see ln 449 of system-tests/grpc/trading/tradesTest Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/1919-close-out-occurs-above-maintenance.feature b/integration/features/1919-close-out-occurs-above-maintenance.feature index a5617618d5..0a03c1b753 100644 --- a/integration/features/1919-close-out-occurs-above-maintenance.feature +++ b/integration/features/1919-close-out-occurs-above-maintenance.feature @@ -4,8 +4,8 @@ Feature: Setting up 5 traders so that at once all the orders are places they end Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/1920-trader-with-no-pos-and-stopped-fok-should-have-0-margin.feature b/integration/features/1920-trader-with-no-pos-and-stopped-fok-should-have-0-margin.feature index 68c5b17d71..c01c5975fd 100644 --- a/integration/features/1920-trader-with-no-pos-and-stopped-fok-should-have-0-margin.feature +++ b/integration/features/1920-trader-with-no-pos-and-stopped-fok-should-have-0-margin.feature @@ -3,11 +3,11 @@ Feature: test for issue 1920 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: a trader place a new order in the system, margin are calculated, then the order is stopped, the margin is released Given the following traders: diff --git a/integration/features/2668-price-monitoring.feature b/integration/features/2668-price-monitoring.feature index c87633292d..3f3b368ea6 100644 --- a/integration/features/2668-price-monitoring.feature +++ b/integration/features/2668-price-monitoring.feature @@ -3,11 +3,11 @@ Feature: Price monitoring test for issue 2668 Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 5000000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 0.8 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 1 | 43200 | 0.9999999 | 300 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 5000000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 0.8 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 1 | 43200 | 0.9999999 | 300 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_CONTINUOUS" Scenario: Upper bound breached diff --git a/integration/features/2681-price-monitoring.feature b/integration/features/2681-price-monitoring.feature index a044817cc4..ca016d1560 100644 --- a/integration/features/2681-price-monitoring.feature +++ b/integration/features/2681-price-monitoring.feature @@ -3,11 +3,11 @@ Feature: Price monitoring test for issue 2681 Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamda | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 5000000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 0.8 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 1 | 43200 | 0.9999999 | 300 | | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 5000000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 0.8 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 1 | 43200 | 0.9999999 | 300 | | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_CONTINUOUS" Scenario: Upper bound breached diff --git a/integration/features/2943-distressed-trader-has-general-balance.feature b/integration/features/2943-distressed-trader-has-general-balance.feature index 1fdfda8a49..ceb62e83f1 100644 --- a/integration/features/2943-distressed-trader-has-general-balance.feature +++ b/integration/features/2943-distressed-trader-has-general-balance.feature @@ -3,11 +3,11 @@ Feature: Distressed traders should not have general balance left Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_CONTINUOUS" Scenario: Upper bound breached diff --git a/integration/features/2952-opening-auction-extension-csv.feature b/integration/features/2952-opening-auction-extension-csv.feature index 0eb43c8262..1a52976dec 100644 --- a/integration/features/2952-opening-auction-extension-csv.feature +++ b/integration/features/2952-opening-auction-extension-csv.feature @@ -4,8 +4,8 @@ Feature: Set up a market, with an opening auction, then uncross the book Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | ETH | ETH | ETH | 100 | simple | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0.004 | 0.001 | 0.3 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | ETH | ETH | ETH | 100 | simple | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0.004 | 0.001 | 0.3 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/2952-opening-auction-uncrossing.feature b/integration/features/2952-opening-auction-uncrossing.feature index 32a6d98ed6..8e6bc7ae4d 100644 --- a/integration/features/2952-opening-auction-uncrossing.feature +++ b/integration/features/2952-opening-auction-uncrossing.feature @@ -4,8 +4,8 @@ Feature: Set up a market, with an opening auction, then uncross the book. Make s Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | ETH | ETH | ETH | 100 | simple | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0.004 | 0.001 | 0.3 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | ETH | ETH | ETH | 100 | simple | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0.004 | 0.001 | 0.3 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/596-Opened-positions-traded-out-but-there-is-still-money-sitting-in-a-margin-account.feature b/integration/features/596-Opened-positions-traded-out-but-there-is-still-money-sitting-in-a-margin-account.feature index 9d0e8fa455..fbeb6dac7d 100644 --- a/integration/features/596-Opened-positions-traded-out-but-there-is-still-money-sitting-in-a-margin-account.feature +++ b/integration/features/596-Opened-positions-traded-out-but-there-is-still-money-sitting-in-a-margin-account.feature @@ -3,11 +3,11 @@ Feature: Regression test for issue 596 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Traded out position but monies left in margin account Given the following traders: diff --git a/integration/features/596-margin-account-non-zero-after-trading-out-market-order.feature b/integration/features/596-margin-account-non-zero-after-trading-out-market-order.feature index 0eb0e99736..e2fca269ab 100644 --- a/integration/features/596-margin-account-non-zero-after-trading-out-market-order.feature +++ b/integration/features/596-margin-account-non-zero-after-trading-out-market-order.feature @@ -3,11 +3,11 @@ Feature: Regression test for issue 596 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Traded out position but monies left in margin account Given the following traders: diff --git a/integration/features/598-open-position-with-zero-margin.feature b/integration/features/598-open-position-with-zero-margin.feature index 30842f4443..5718b481fc 100644 --- a/integration/features/598-open-position-with-zero-margin.feature +++ b/integration/features/598-open-position-with-zero-margin.feature @@ -3,11 +3,11 @@ Feature: Regression test for issue 598 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Open position but ZERO in margin account Given the following traders: diff --git a/integration/features/614-margin-calculations-fixes.feature b/integration/features/614-margin-calculations-fixes.feature index a859d0a4f8..608ab9b8ae 100644 --- a/integration/features/614-margin-calculations-fixes.feature +++ b/integration/features/614-margin-calculations-fixes.feature @@ -3,8 +3,8 @@ Feature: test bugfix 614 for margin calculations Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 94 | simple | 0.2 | 0.1 | 0 | 0 | 0 | 5 | 4 | 3.2 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 94 | simple | 0.2 | 0.1 | 0 | 0 | 0 | 5 | 4 | 3.2 | 100 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/630-position-resolution-negative-insurance-pool.feature b/integration/features/630-position-resolution-negative-insurance-pool.feature index 7b119e09f9..785fb6301b 100644 --- a/integration/features/630-position-resolution-negative-insurance-pool.feature +++ b/integration/features/630-position-resolution-negative-insurance-pool.feature @@ -3,11 +3,11 @@ Feature: Regression test for issue 630 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.2 | 0.1 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.2 | 0.1 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Trader is being closed out. # setup accounts diff --git a/integration/features/635-margin-calculation.feature b/integration/features/635-margin-calculation.feature index 5526e52355..6d687975de 100644 --- a/integration/features/635-margin-calculation.feature +++ b/integration/features/635-margin-calculation.feature @@ -3,11 +3,11 @@ Feature: Regression test for issue 596 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0.2 | 0.1 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0.2 | 0.1 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Traded out position but monies left in margin account # setup accounts diff --git a/integration/features/760_cancel_filled_order.feature b/integration/features/760_cancel_filled_order.feature index b2ce23e452..1cc839a533 100644 --- a/integration/features/760_cancel_filled_order.feature +++ b/integration/features/760_cancel_filled_order.feature @@ -3,11 +3,11 @@ Feature: Close a filled order twice Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Traders place an order, a trade happens, and orders are cancelled after being filled # setup accounts diff --git a/integration/features/762_missing_party_and_order.feature b/integration/features/762_missing_party_and_order.feature index a7f052c6a0..4c969d0b53 100644 --- a/integration/features/762_missing_party_and_order.feature +++ b/integration/features/762_missing_party_and_order.feature @@ -3,11 +3,11 @@ Feature: Test crash on cancel of missing order Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: A non-existent party attempts to place an order Given missing traders place following orders with references: diff --git a/integration/features/767-margin-level-check.feature b/integration/features/767-margin-level-check.feature index 6c8901a2c7..96987f0a63 100644 --- a/integration/features/767-margin-level-check.feature +++ b/integration/features/767-margin-level-check.feature @@ -3,11 +3,11 @@ Feature: Regression test for issue 767 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | forward | 0.001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Traders place orders meeting the maintenance margin, but not the initial margin requirements, and can close out Given the following traders: diff --git a/integration/features/amend-order.feature b/integration/features/amend-order.feature index 3377205bcd..4362141ba5 100644 --- a/integration/features/amend-order.feature +++ b/integration/features/amend-order.feature @@ -3,11 +3,11 @@ Feature: Amend orders Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Amend rejected for non existing order # setup accounts diff --git a/integration/features/building_trader_accounts.feature b/integration/features/building_trader_accounts.feature index 00a413f443..b88f0a8eaa 100644 --- a/integration/features/building_trader_accounts.feature +++ b/integration/features/building_trader_accounts.feature @@ -3,12 +3,12 @@ Feature: Test trader accounts Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | - | GBPUSD/DEC19 | GPB | USD | VUSD | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xBADC0FEE | prices.USD.value | TYPE_INTEGER | prices.USD.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | GBPUSD/DEC19 | GPB | USD | VUSD | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xBADC0FEE | prices.USD.value | TYPE_INTEGER | prices.USD.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: a trader is added to the system. A general account is created for each asset Given the following traders: diff --git a/integration/features/ensure-funds-are-released.feature b/integration/features/ensure-funds-are-released.feature index d6065cfde8..d8f497943f 100644 --- a/integration/features/ensure-funds-are-released.feature +++ b/integration/features/ensure-funds-are-released.feature @@ -3,11 +3,11 @@ Feature: Test margins releases on position = 0 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0.2 | 0.1 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0.2 | 0.1 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: No margin left for fok order as first order # setup accounts diff --git a/integration/features/liquidity_provision_simple.feature b/integration/features/liquidity_provision_simple.feature index 70377d645a..dcfbfbb054 100644 --- a/integration/features/liquidity_provision_simple.feature +++ b/integration/features/liquidity_provision_simple.feature @@ -3,12 +3,11 @@ Feature: Test LP orders Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | - + | prices.ETH.value | 42 | Scenario: create liquidity provisions Given the following traders: | name | amount | diff --git a/integration/features/margins.feature b/integration/features/margins.feature index 213b9bc48d..5e2538b789 100644 --- a/integration/features/margins.feature +++ b/integration/features/margins.feature @@ -3,11 +3,11 @@ Feature: Test trader accounts Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: a trader place a new order in the system, margin are calculated Given the following traders: diff --git a/integration/features/mark_to_mark_settlement_using_insurance_pool.feature b/integration/features/mark_to_mark_settlement_using_insurance_pool.feature index 6e19a97637..7ccecd1abb 100644 --- a/integration/features/mark_to_mark_settlement_using_insurance_pool.feature +++ b/integration/features/mark_to_mark_settlement_using_insurance_pool.feature @@ -3,11 +3,11 @@ Feature: Test mark to market settlement with insurance pool Background: Given the insurance pool initial balance for the markets is "10000": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: If settlement amount > trader’s margin account balance + trader’s general account balance for the asset, the full balance of the trader’s margin account is transferred to the market’s temporary settlement account, the full balance of the trader’s general account for the assets are transferred to the market’s temporary settlement account, the minimum insurance pool account balance for the market & asset, and the remainder, i.e. the difference between the total amount transferred from the trader’s margin + general accounts and the settlement amount, is transferred from the insurance pool account for the market to the temporary settlement account for the market Given the following traders: diff --git a/integration/features/mark_to_market_settlement.feature b/integration/features/mark_to_market_settlement.feature index 1fafe4af25..3dd789d01b 100644 --- a/integration/features/mark_to_market_settlement.feature +++ b/integration/features/mark_to_market_settlement.feature @@ -3,11 +3,11 @@ Feature: Test mark to market settlement Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: If settlement amount <= the trader’s margin account balance entire settlement amount is transferred from trader’s margin account to the market’s temporary settlement account Given the following traders: diff --git a/integration/features/market-depth-1.feature b/integration/features/market-depth-1.feature index 16f24f685f..755122d730 100644 --- a/integration/features/market-depth-1.feature +++ b/integration/features/market-depth-1.feature @@ -3,11 +3,11 @@ Feature: Test market depth events for pegged orders Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Ensure the expected order events for pegged orders are produced when mid price changes # setup accounts diff --git a/integration/features/market-depth-2.feature b/integration/features/market-depth-2.feature index 7c5f5e3f60..f7c465904c 100644 --- a/integration/features/market-depth-2.feature +++ b/integration/features/market-depth-2.feature @@ -3,11 +3,11 @@ Feature: Test market depth events for pegged orders Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Check order events with larger pegged orders, and lower balance # setup accounts diff --git a/integration/features/market-depth-3.feature b/integration/features/market-depth-3.feature index 16559f8d30..f35c30fb4d 100644 --- a/integration/features/market-depth-3.feature +++ b/integration/features/market-depth-3.feature @@ -3,11 +3,11 @@ Feature: Test market depth events for pegged orders (with BID and ASK price) Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Ensure the expect order events for pegged orders are produced for all references # setup accounts diff --git a/integration/features/market-depth-4.feature b/integration/features/market-depth-4.feature index 2a8110a560..94edd65ef2 100644 --- a/integration/features/market-depth-4.feature +++ b/integration/features/market-depth-4.feature @@ -4,11 +4,11 @@ Feature: Test market depth events for pegged orders (cancelling pegged orders) Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Check order events with larger pegged orders, and lower balance # setup accounts diff --git a/integration/features/network-order-and-trades-sub.feature b/integration/features/network-order-and-trades-sub.feature index 3c014ac2b2..fdcd3096fb 100644 --- a/integration/features/network-order-and-trades-sub.feature +++ b/integration/features/network-order-and-trades-sub.feature @@ -3,11 +3,11 @@ Feature: Ensure network trader are generated Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Implement trade and order network # setup accounts diff --git a/integration/features/opening-auction-uncross.feature b/integration/features/opening-auction-uncross.feature index 3c0ee3ca72..1082a2334e 100644 --- a/integration/features/opening-auction-uncross.feature +++ b/integration/features/opening-auction-uncross.feature @@ -3,8 +3,8 @@ Feature: Set up a market, with an opening auction, then uncross the book Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0.1 | 0.1 | -1 | -1 | -1 | 1.4 | 1.2 | 1.1 | 100 | 1 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 100 | diff --git a/integration/features/price-monitoring-for-system-test.feature b/integration/features/price-monitoring-for-system-test.feature index c7ccc345a4..986f82d84f 100644 --- a/integration/features/price-monitoring-for-system-test.feature +++ b/integration/features/price-monitoring-for-system-test.feature @@ -3,11 +3,11 @@ Feature: Price monitoring test using forward risk model (bounds for the valid pr Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 900000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 5 | continuous | 0 | 0 | 0 | 4 | 5,10 | 0.95,0.99 | 6,8 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 900000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 5 | continuous | 0 | 0 | 0 | 4 | 5,10 | 0.95,0.99 | 6,8 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_OPENING_AUCTION" Scenario: Scenario for the system test with opening auction diff --git a/integration/features/price-monitoring-lognormal.feature b/integration/features/price-monitoring-lognormal.feature index 1749fc43d5..aa97c5bd51 100644 --- a/integration/features/price-monitoring-lognormal.feature +++ b/integration/features/price-monitoring-lognormal.feature @@ -3,11 +3,11 @@ Feature: Price monitoring test using forward risk model (bounds for the valid pr Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 100000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 60 | 60,120 | 0.95,0.99 | 240,360 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 100000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 60 | 60,120 | 0.95,0.99 | 240,360 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_CONTINUOUS" Scenario: Persistent order results in an auction (both triggers breached), no orders placed during auction, auction terminates with a trade from order that originally triggered the auction. diff --git a/integration/features/price-monitoring-lognormal2.feature b/integration/features/price-monitoring-lognormal2.feature index 1e7260d8f0..cee356cbd3 100644 --- a/integration/features/price-monitoring-lognormal2.feature +++ b/integration/features/price-monitoring-lognormal2.feature @@ -3,11 +3,11 @@ Feature: Price monitoring test using forward risk model (bounds for the valid pr Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 100000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 6000 | 3600,7200 | 0.95,0.999 | 240,360 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 100000 | forward | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 6000 | 3600,7200 | 0.95,0.999 | 240,360 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_CONTINUOUS" Scenario: Auction triggered by 1st trigger (lower bound breached) diff --git a/integration/features/price-monitoring-simple.feature b/integration/features/price-monitoring-simple.feature index b9c251c32c..c887b7f83e 100644 --- a/integration/features/price-monitoring-simple.feature +++ b/integration/features/price-monitoring-simple.feature @@ -3,11 +3,11 @@ Feature: Price monitoring test using simple risk model Background: Given the markets starts on "2020-10-16T00:00:00Z" and expires on "2020-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC20 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 10 | -11 | -1 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 60 | 60,120 | 0.95,0.99 | 240,360 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC20 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 10 | -11 | -1 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 60 | 60,120 | 0.95,0.99 | 240,360 | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | And the market trading mode for the market "ETH/DEC20" is "TRADING_MODE_CONTINUOUS" Scenario: Persistent order results in an auction (both triggers breached), no orders placed during auction, auction terminates with a trade from order that originally triggered the auction. diff --git a/integration/features/settlement_at_expiry.feature b/integration/features/settlement_at_expiry.feature index bab5501522..607ec9f557 100644 --- a/integration/features/settlement_at_expiry.feature +++ b/integration/features/settlement_at_expiry.feature @@ -3,11 +3,11 @@ Feature: Test mark to market settlement Background: Given the markets starts on "2019-11-30T00:00:00Z" and expires on "2019-12-31T23:59:59Z" And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlement price | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 1000 | simple | 0.11 | 0.1 | 0 | 0 | 0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: Order cannot be placed once the market is expired Given the following traders: diff --git a/integration/features/verified-loss-socialization-case1.feature b/integration/features/verified-loss-socialization-case1.feature index 0e2abfacd8..5be43022cf 100644 --- a/integration/features/verified-loss-socialization-case1.feature +++ b/integration/features/verified-loss-socialization-case1.feature @@ -4,11 +4,11 @@ Feature: Test loss socialization case 1 Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: case 1 from https://docs.google.com/spreadsheets/d/1CIPH0aQmIKj6YeFW9ApP_l-jwB4OcsNQ/edit#gid=1555964910 # setup accounts diff --git a/integration/features/verified-loss-socialization-case2.feature b/integration/features/verified-loss-socialization-case2.feature index a336dfc72f..cf333626b2 100644 --- a/integration/features/verified-loss-socialization-case2.feature +++ b/integration/features/verified-loss-socialization-case2.feature @@ -3,11 +3,11 @@ Feature: Test loss socialization case 2 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: case 2 from https://docs.google.com/spreadsheets/d/1CIPH0aQmIKj6YeFW9ApP_l-jwB4OcsNQ/edit#gid=1555964910 # setup accounts diff --git a/integration/features/verified-loss-socialization-case3.feature b/integration/features/verified-loss-socialization-case3.feature index c50064c7d6..8d2cbba80b 100644 --- a/integration/features/verified-loss-socialization-case3.feature +++ b/integration/features/verified-loss-socialization-case3.feature @@ -3,11 +3,11 @@ Feature: Test loss socialization case 3 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: case 3 from https://docs.google.com/spreadsheets/d/1CIPH0aQmIKj6YeFW9ApP_l-jwB4OcsNQ/edit#gid=1555964910 # setup accounts diff --git a/integration/features/verified-loss-socialization-case4.feature b/integration/features/verified-loss-socialization-case4.feature index f0e64b827c..d91da73909 100644 --- a/integration/features/verified-loss-socialization-case4.feature +++ b/integration/features/verified-loss-socialization-case4.feature @@ -3,11 +3,11 @@ Feature: Test loss socialization case 4 Background: Given the insurance pool initial balance for the markets is "2900": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: case 4 from https://docs.google.com/spreadsheets/d/1CIPH0aQmIKj6YeFW9ApP_l-jwB4OcsNQ/edit#gid=1555964910 # setup accounts diff --git a/integration/features/verified-loss-socialization-case5.feature b/integration/features/verified-loss-socialization-case5.feature index 899b1c1cf3..f20d3f45f5 100644 --- a/integration/features/verified-loss-socialization-case5.feature +++ b/integration/features/verified-loss-socialization-case5.feature @@ -3,11 +3,11 @@ Feature: Test loss socialization case 5 Background: Given the insurance pool initial balance for the markets is "3000": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: case 5 from https://docs.google.com/spreadsheets/d/1CIPH0aQmIKj6YeFW9ApP_l-jwB4OcsNQ/edit#gid=1555964910 # setup accounts diff --git a/integration/features/verified-mark-to-market-settlement.feature b/integration/features/verified-mark-to-market-settlement.feature index 2533e22dd3..ea2bf5baec 100644 --- a/integration/features/verified-mark-to-market-settlement.feature +++ b/integration/features/verified-mark-to-market-settlement.feature @@ -2,11 +2,11 @@ Feature: MTM settlement tests # Reference spreadsheet: https://drive.google.com/open?id=1ZCj7WWvP236wiJDgiGD_f9Xsun9o8PsW Background: Given the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 100 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 1.4 | 1.2 | 1.1 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: case 1 - LONG - MORE LONG - one trade # setup accounts diff --git a/integration/features/verified-positions-resolution-1.feature b/integration/features/verified-positions-resolution-1.feature index 6f275c5291..02df12a2ae 100644 --- a/integration/features/verified-positions-resolution-1.feature +++ b/integration/features/verified-positions-resolution-1.feature @@ -3,11 +3,11 @@ Feature: Position resolution case 1 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: https://docs.google.com/spreadsheets/d/1D433fpt7FUCk04dZ9FHDVy-4hA6Bw_a2/edit#gid=956988479 # setup accounts diff --git a/integration/features/verified-positions-resolution-2.feature b/integration/features/verified-positions-resolution-2.feature index 0ee5c08390..6bac724bfc 100644 --- a/integration/features/verified-positions-resolution-2.feature +++ b/integration/features/verified-positions-resolution-2.feature @@ -3,11 +3,11 @@ Feature: Position resolution case 2 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: https://docs.google.com/spreadsheets/d/1D433fpt7FUCk04dZ9FHDVy-4hA6Bw_a2/edit#gid=1011478143 # setup accounts diff --git a/integration/features/verified-positions-resolution-3.feature b/integration/features/verified-positions-resolution-3.feature index cba9c200b8..155eb30dae 100644 --- a/integration/features/verified-positions-resolution-3.feature +++ b/integration/features/verified-positions-resolution-3.feature @@ -3,11 +3,11 @@ Feature: Position resolution case 3 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: https://docs.google.com/spreadsheets/d/1D433fpt7FUCk04dZ9FHDVy-4hA6Bw_a2 # setup accounts diff --git a/integration/features/verified-positions-resolution-4.feature b/integration/features/verified-positions-resolution-4.feature index 48df99a8d4..de7de80ecf 100644 --- a/integration/features/verified-positions-resolution-4.feature +++ b/integration/features/verified-positions-resolution-4.feature @@ -3,11 +3,11 @@ Feature: Position resolution case 4 Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | lamd/long | tau/short | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | lamd/long | tau/short | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | ETH | BTC | BTC | 94 | simple | 0 | 0 | 0 | 0.016 | 2.0 | 5 | 4 | 3.2 | 42 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | - | prices.ETH.value | 42 | + | prices.ETH.value | 42 | Scenario: https://drive.google.com/file/d/1bYWbNJvG7E-tcqsK26JMu2uGwaqXqm0L/view # setup accounts diff --git a/integration/features/verified_margins_case1.feature b/integration/features/verified_margins_case1.feature index e377292616..170cac4e2d 100644 --- a/integration/features/verified_margins_case1.feature +++ b/integration/features/verified_margins_case1.feature @@ -4,11 +4,11 @@ Feature: CASE-1: Trader submits long order that will trade - new formula & high Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | tau/short | lamd/long | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | tau/short | lamd/long | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": - | name | value | - | prices.ETH.value | 9400000 | + | name | value | + | prices.ETH.value | 9400000 | And the following traders: | name | amount | | trader1 | 1000000000 | @@ -42,9 +42,9 @@ Feature: CASE-1: Trader submits long order that will trade - new formula & high And "trader1" have only one account per asset # placing test order Then traders place following orders: - | trader | market id | type | volume | price | trades | type | tif | + | trader | market id | type | volume | price | trades | type | tif | | trader1 | ETH/DEC19 | buy | 13 | 15000000 | 2 | TYPE_LIMIT | TIF_GTC | - And "trader1" general account for asset "ETH" balance is "683999968" + And "trader1" general account for asset "ETH" balance is "611199968" And executed trades: | buyer | price | size | seller | | trader1 | 11200000 | 2 | sellSideMM | @@ -56,10 +56,10 @@ Feature: CASE-1: Trader submits long order that will trade - new formula & high And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 321600032 | 683999968 | + | trader1 | ETH | ETH/DEC19 | 394400032 | 611199968 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 80400008 | 257280025 | 321600032 | 402000040 | + | trader1 | ETH/DEC19 | 98600008 | 315520025 | 394400032 | 493000040 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 5600000 | 0 | @@ -78,10 +78,10 @@ Feature: CASE-1: Trader submits long order that will trade - new formula & high And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 321600032 | 683999968 | + | trader1 | ETH | ETH/DEC19 | 394400032 | 611199968 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 80400008 | 257280025 | 321600032 | 402000040 | + | trader1 | ETH/DEC19 | 98600008 | 315520025 | 394400032 | 493000040 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 5600000 | 0 | @@ -99,10 +99,10 @@ Feature: CASE-1: Trader submits long order that will trade - new formula & high And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 240000020 | 843599980 | + | trader1 | ETH | ETH/DEC19 | 344000020 | 739599980 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 60000005 | 192000016 | 240000020 | 300000025 | + | trader1 | ETH/DEC19 | 86000005 | 275200016 | 344000020 | 430000025 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 83600000 | 0 | diff --git a/integration/features/verified_margins_case2.feature b/integration/features/verified_margins_case2.feature index 0003c0e78d..23e594879b 100644 --- a/integration/features/verified_margins_case2.feature +++ b/integration/features/verified_margins_case2.feature @@ -4,8 +4,8 @@ Feature: CASE-2: Trader submits long order that will trade - new formula & low e Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | tau/short | lamd/long | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | tau/short | lamd/long | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 9400000 | @@ -42,9 +42,9 @@ Feature: CASE-2: Trader submits long order that will trade - new formula & low e And "trader1" have only one account per asset # placing test order Then traders place following orders: - | trader | market id | type | volume | price | trades | type | tif | + | trader | market id | type | volume | price | trades | type | tif | | trader1 | ETH/DEC19 | buy | 13 | 15000000 | 2 | TYPE_LIMIT | TIF_GTC | - And "trader1" general account for asset "ETH" balance is "647999952" + And "trader1" general account for asset "ETH" balance is "575199952" And executed trades: | buyer | price | size | seller | | trader1 | 11200000 | 2 | sellSideMM | @@ -56,10 +56,10 @@ Feature: CASE-2: Trader submits long order that will trade - new formula & low e And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 357600048 | 647999952 | + | trader1 | ETH | ETH/DEC19 | 430400048 | 575199952 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 89400012 | 286080038 | 357600048 | 447000060 | + | trader1 | ETH/DEC19 | 107600012 | 344320038 | 430400048 | 538000060 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 5600000 | 0 | @@ -72,10 +72,10 @@ Feature: CASE-2: Trader submits long order that will trade - new formula & low e And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 357600048 | 647999952 | + | trader1 | ETH | ETH/DEC19 | 430400048 | 575199952 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 89400012 | 286080038 | 357600048 | 447000060 | + | trader1 | ETH/DEC19 | 107600012 | 344320038 | 430400048 | 538000060 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 5600000 | 0 | @@ -93,10 +93,10 @@ Feature: CASE-2: Trader submits long order that will trade - new formula & low e And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 156000000 | 797600000 | + | trader1 | ETH | ETH/DEC19 | 208000000 | 745600000 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 39000000 | 124800000 | 156000000 | 195000000 | + | trader1 | ETH/DEC19 | 52000000 | 166400000 | 208000000 | 260000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | -46400000 | 0 | @@ -107,10 +107,10 @@ Feature: CASE-2: Trader submits long order that will trade - new formula & low e | trader1 | ETH/DEC19 | sell | 10 | 8000000 | 1 | TYPE_LIMIT | TIF_GTC | And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 9600000 | 918000000 | + | trader1 | ETH | ETH/DEC19 | 19200000 | 908400000 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 2400000 | 7680000 | 9600000 | 12000000 | + | trader1 | ETH/DEC19 | 4800000 | 15360000 | 19200000 | 24000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 3 | -16707692 | -55692308 | diff --git a/integration/features/verified_margins_case3.feature b/integration/features/verified_margins_case3.feature index e486efaed8..c93b953070 100644 --- a/integration/features/verified_margins_case3.feature +++ b/integration/features/verified_margins_case3.feature @@ -4,8 +4,8 @@ Feature: CASE-3: Trader submits long order that will trade - new formula & zero Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | tau/short | lamd/long | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | tau/short | lamd/long | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 9400000 | @@ -38,9 +38,9 @@ Feature: CASE-3: Trader submits long order that will trade - new formula & zero And "trader1" have only one account per asset # placing test order Then traders place following orders: - | trader | market id | type | volume | price | trades | type | tif | + | trader | market id | type | volume | price | trades | type | tif | | trader1 | ETH/DEC19 | buy | 13 | 15000000 | 2 | TYPE_LIMIT | TIF_GTC | - And "trader1" general account for asset "ETH" balance is "946440000" + And "trader1" general account for asset "ETH" balance is "860000000" And executed trades: | buyer | price | size | seller | | trader1 | 11200000 | 2 | sellSideMM | @@ -52,10 +52,10 @@ Feature: CASE-3: Trader submits long order that will trade - new formula & zero And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 59160000 | 946440000 | + | trader1 | ETH | ETH/DEC19 | 145600000 | 860000000 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 18200000 | 58240000 | 72800000 | 91000000 | + | trader1 | ETH/DEC19 | 36400000 | 116480000 | 145600000 | 182000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 5600000 | 0 | @@ -73,10 +73,10 @@ Feature: CASE-3: Trader submits long order that will trade - new formula & zero And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 85160000 | 946440000 | + | trader1 | ETH | ETH/DEC19 | 171600000 | 860000000 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 20800000 | 66560000 | 83200000 | 104000000 | + | trader1 | ETH/DEC19 | 41600000 | 133120000 | 166400000 | 208000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 31600000 | 0 | @@ -87,10 +87,10 @@ Feature: CASE-3: Trader submits long order that will trade - new formula & zero | trader1 | ETH/DEC19 | sell | 13 | 8000000 | 0 | TYPE_LIMIT | TIF_GTC | And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 85160000 | 946440000 | + | trader1 | ETH | ETH/DEC19 | 171600000 | 860000000 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 20800000 | 66560000 | 83200000 | 104000000 | + | trader1 | ETH/DEC19 | 41600000 | 133120000 | 166400000 | 208000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | 13 | 31600000 | 0 | diff --git a/integration/features/verified_margins_case4.feature b/integration/features/verified_margins_case4.feature index d6bf34112b..07d7a77b9a 100644 --- a/integration/features/verified_margins_case4.feature +++ b/integration/features/verified_margins_case4.feature @@ -4,8 +4,8 @@ Feature: CASE-4: Trader submits short order that will trade - new formula & high Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | tau/short | lamd/long | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | tau/short | lamd/long | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 9400000 | 0 | continuous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 9400000 | @@ -42,9 +42,9 @@ Feature: CASE-4: Trader submits short order that will trade - new formula & high And "trader1" have only one account per asset # placing test order Then traders place following orders: - | trader | market id | type | volume | price | trades | type | tif | + | trader | market id | type | volume | price | trades | type | tif | | trader1 | ETH/DEC19 | sell | 13 | 9000000 | 3 | TYPE_LIMIT | TIF_GTC | - And "trader1" general account for asset "ETH" balance is "671600040" + And "trader1" general account for asset "ETH" balance is "718400040" And executed trades: | buyer | price | size | seller | | buySideMM | 10000000 | 1 | trader1 | @@ -57,10 +57,10 @@ Feature: CASE-4: Trader submits short order that will trade - new formula & high And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 331199960 | 671600040 | + | trader1 | ETH | ETH/DEC19 | 284399960 | 718400040 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 82799990 | 264959968 | 331199960 | 413999950 | + | trader1 | ETH/DEC19 | 71099990 | 227519968 | 284399960 | 355499950 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | 2800000 | 0 | @@ -82,10 +82,10 @@ Feature: CASE-4: Trader submits short order that will trade - new formula & high And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 331199960 | 671600040 | + | trader1 | ETH | ETH/DEC19 | 284399960 | 718400040 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 82799990 | 264959968 | 331199960 | 413999950 | + | trader1 | ETH/DEC19 | 71099990 | 227519968 | 284399960 | 355499950 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | 2800000 | 0 | @@ -104,10 +104,10 @@ Feature: CASE-4: Trader submits short order that will trade - new formula & high And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 121599972 | 894200028 | + | trader1 | ETH | ETH/DEC19 | 79999972 | 935800028 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 30399993 | 97279977 | 121599972 | 151999965 | + | trader1 | ETH/DEC19 | 19999993 | 63999977 | 79999972 | 99999965 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | 15800000 | 0 | diff --git a/integration/features/verified_margins_case5.feature b/integration/features/verified_margins_case5.feature index f518d78529..5ff1ab06e7 100644 --- a/integration/features/verified_margins_case5.feature +++ b/integration/features/verified_margins_case5.feature @@ -4,8 +4,8 @@ Feature: CASE-5: Trader submits short order that will trade - new formula & low Background: Given the insurance pool initial balance for the markets is "0": And the execution engine have these markets: - | name | baseName | quoteName | asset | markprice | risk model | tau/short | lamd/long | mu | r | sigma | release factor | initial factor | search factor | settlementPrice | openAuction | trading mode | makerFee | infrastructureFee | liquidityFee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | Prob of trading | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | oracleSpecPubKeys | oracleSpecProperty | oracleSpecPropertyType | oracleSpecBinding | - | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 940000 | 0 | continous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | + | name | base name | quote name | asset | mark price | risk model | tau/short | lamd/long | mu/max move up | r/min move down | sigma | release factor | initial factor | search factor | settlement price | auction duration | trading mode | maker fee | infrastructure fee | liquidity fee | p. m. update freq. | p. m. horizons | p. m. probs | p. m. durations | prob. of trading | oracle spec pub. keys | oracle spec property | oracle spec property type | oracle spec binding | + | ETH/DEC19 | BTC | ETH | ETH | 9400000 | simple | 0.1 | 0.2 | 0 | 0 | 0 | 5 | 4 | 3.2 | 940000 | 0 | continous | 0 | 0 | 0 | 0 | | | | 0.1 | 0xDEADBEEF,0xCAFEDOOD | prices.ETH.value | TYPE_INTEGER | prices.ETH.value | And oracles broadcast data signed with "0xDEADBEEF": | name | value | | prices.ETH.value | 9400000 | @@ -42,9 +42,9 @@ Feature: CASE-5: Trader submits short order that will trade - new formula & low And "trader1" have only one account per asset # placing test order Then traders place following orders: - | trader | market id | type | volume | price | trades | type | tif | + | trader | market id | type | volume | price | trades | type | tif | | trader1 | ETH/DEC19 | sell | 13 | 9000000 | 3 | TYPE_LIMIT | TIF_GTC | - And "trader1" general account for asset "ETH" balance is "671600040" + And "trader1" general account for asset "ETH" balance is "718400040" And executed trades: | buyer | price | size | seller | | buySideMM | 10000000 | 1 | trader1 | @@ -56,10 +56,10 @@ Feature: CASE-5: Trader submits short order that will trade - new formula & low And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 331199960 | 671600040 | + | trader1 | ETH | ETH/DEC19 | 284399960 | 718400040 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 82799990 | 264959968 | 331199960 | 413999950 | + | trader1 | ETH/DEC19 | 71099990 | 227519968 | 284399960 | 355499950 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | 2800000 | 0 | @@ -78,10 +78,10 @@ Feature: CASE-5: Trader submits short order that will trade - new formula & low | sellSideMM | ETH/DEC19 | sell | 2 | 8000000 | 0 | TYPE_LIMIT | TIF_GTC | And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 331199960 | 671600040 | + | trader1 | ETH | ETH/DEC19 | 284399960 | 718400040 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 82799990 | 264959968 | 331199960 | 413999950 | + | trader1 | ETH/DEC19 | 71099990 | 227519968 | 284399960 | 355499950 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | 2800000 | 0 | @@ -97,14 +97,14 @@ Feature: CASE-5: Trader submits short order that will trade - new formula & low And the following transfers happened: | from | to | fromType | toType | id | amount | asset | | trader1 | market | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_SETTLEMENT | ETH/DEC19 | 273000000 | ETH | - | trader1 | trader1 | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_MARGIN | ETH/DEC19 | 253800040 | ETH | + | trader1 | trader1 | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_MARGIN | ETH/DEC19 | 144600040 | ETH | And I expect the trader to have a margin: | trader | asset | market id | margin | general | - | trader1 | ETH | ETH/DEC19 | 312000000 | 417800000 | + | trader1 | ETH | ETH/DEC19 | 156000000 | 573800000 | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 78000000 | 249600000 | 312000000 | 390000000 | + | trader1 | ETH/DEC19 | 39000000 | 124800000 | 156000000 | 195000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | -270200000 | 0 | @@ -116,7 +116,7 @@ Feature: CASE-5: Trader submits short order that will trade - new formula & low | buySideMM | ETH/DEC19 | buy | 50 | 50000000 | 2 | TYPE_LIMIT | TIF_GTC | And the margins levels for the traders are: | trader | market id | maintenance | search | initial | release | - | trader1 | ETH/DEC19 | 130000000 | 416000000 | 520000000 | 650000000 | + | trader1 | ETH/DEC19 | 65000000 | 208000000 | 260000000 | 325000000 | And position API produce the following: | trader | volume | unrealisedPNL | realisedPNL | | trader1 | -13 | -530200000 | 0 | diff --git a/integration/gherkin_test.go b/integration/gherkin_test.go index 4fc8d24d1b..02851bfb5b 100644 --- a/integration/gherkin_test.go +++ b/integration/gherkin_test.go @@ -5,10 +5,9 @@ import ( "strconv" "strings" - "code.vegaprotocol.io/vega/proto" - oraclesv1 "code.vegaprotocol.io/vega/proto/oracles/v1" - "github.com/cucumber/godog/gherkin" + + "code.vegaprotocol.io/vega/proto" ) func val(rows *gherkin.TableRow, idx int) string { @@ -27,48 +26,6 @@ func i64val(rows *gherkin.TableRow, idx int) int64 { return ret } -func f64val(rows *gherkin.TableRow, idx int) float64 { - s := rows.Cells[idx].Value - ret, _ := strconv.ParseFloat(s, 10) - return ret -} - -func f64arr(rows *gherkin.TableRow, idx int, sep string) ([]float64, error) { - rawString := rows.Cells[idx].Value - sArr := strings.Split(rawString, sep) - n := len(sArr) - if len(rawString) == 0 { - n = 0 - } - f64arr := make([]float64, 0, len(sArr)) - for i := 0; i < n; i++ { - f64, err := strconv.ParseFloat(sArr[i], 10) - if err != nil { - return nil, err - } - f64arr = append(f64arr, f64) - } - return f64arr, nil -} - -func i64arr(rows *gherkin.TableRow, idx int, sep string) ([]int64, error) { - rawString := rows.Cells[idx].Value - sArr := strings.Split(rawString, sep) - n := len(sArr) - if len(rawString) == 0 { - n = 0 - } - i64arr := make([]int64, 0, n) - for i := 0; i < n; i++ { - i64, err := strconv.ParseInt(sArr[i], 10, 0) - if err != nil { - return nil, err - } - i64arr = append(i64arr, i64) - } - return i64arr, nil -} - func sideval(rows *gherkin.TableRow, idx int) proto.Side { s := rows.Cells[idx].Value if s == "sell" { @@ -101,14 +58,6 @@ func ordertypeval(rows *gherkin.TableRow, idx int) (proto.Order_Type, error) { return proto.Order_Type(ty), nil } -func oracleSpecPropertyTypeVal(rows *gherkin.TableRow, idx int) (oraclesv1.PropertyKey_Type, error) { - ty, ok := oraclesv1.PropertyKey_Type_value[rows.Cells[idx].Value] - if !ok { - return oraclesv1.PropertyKey_Type(ty), fmt.Errorf("invalid oracle property type: %v", rows.Cells[idx].Value) - } - return oraclesv1.PropertyKey_Type(ty), nil -} - func boolval(rows *gherkin.TableRow, idx int) (bool, error) { val := rows.Cells[idx].Value if val == "true" { diff --git a/integration/main_test.go b/integration/main_test.go index 8304c34650..c68f7a6003 100644 --- a/integration/main_test.go +++ b/integration/main_test.go @@ -61,7 +61,7 @@ func FeatureContext(s *godog.Suite) { s.Step(`^the following traders:$`, theFollowingTraders) s.Step(`^I Expect the traders to have new general account:$`, iExpectTheTradersToHaveNewGeneralAccount) s.Step(`^"([^"]*)" general accounts balance is "([^"]*)"$`, generalAccountsBalanceIs) - s.Step(`^the execution engine have these markets:$`, theExecutionEngineHaveTheseMarkets) + s.Step(`^the execution engine have these markets:$`, TheMarket) s.Step(`^traders place following orders:$`, tradersPlaceFollowingOrders) s.Step(`^I expect the trader to have a margin:$`, iExpectTheTraderToHaveAMargin) s.Step(`^All balances cumulated are worth "([^"]*)"$`, allBalancesCumulatedAreWorth) diff --git a/integration/market_step_test.go b/integration/market_step_test.go new file mode 100644 index 0000000000..eed010d888 --- /dev/null +++ b/integration/market_step_test.go @@ -0,0 +1,355 @@ +package core_test + +import ( + "fmt" + "time" + + "github.com/cucumber/godog/gherkin" + + types "code.vegaprotocol.io/vega/proto" + oraclesv1 "code.vegaprotocol.io/vega/proto/oracles/v1" +) + +func TheMarket(table *gherkin.DataTable) error { + markets := []types.Market{} + + for _, row := range TableWrapper(*table).Parse() { + market := newMarket(marketRow{row: row}) + markets = append(markets, market) + } + + t, _ := time.Parse("2006-01-02T15:04:05Z", marketStart) + execsetup = getExecutionTestSetup(t, markets) + + // reset market start time and expiry for next run + marketExpiry = defaultMarketExpiry + marketStart = defaultMarketStart + + return nil +} + +func newMarket(row marketRow) types.Market { + market := types.Market{ + TradingMode: types.Market_TRADING_MODE_CONTINUOUS, + State: types.Market_STATE_ACTIVE, + Id: row.name(), + DecimalPlaces: 2, + Fees: &types.Fees{ + Factors: &types.FeeFactors{ + LiquidityFee: row.liquidityFee(), + InfrastructureFee: row.infrastructureFee(), + MakerFee: row.makerFee(), + }, + }, + TradableInstrument: &types.TradableInstrument{ + Instrument: &types.Instrument{ + Id: fmt.Sprintf("Crypto/%s/Futures", row.name()), + Code: fmt.Sprintf("CRYPTO/%v", row.name()), + Name: fmt.Sprintf("%s future", row.name()), + Metadata: &types.InstrumentMetadata{ + Tags: []string{ + "asset_class:fx/crypto", + "product:futures", + }, + }, + InitialMarkPrice: row.markPrice(), + Product: &types.Instrument_Future{ + Future: &types.Future{ + Maturity: marketExpiry, + SettlementAsset: row.asset(), + QuoteName: row.quoteName(), + OracleSpec: &oraclesv1.OracleSpec{ + PubKeys: row.oracleSpecPubKeys(), + Filters: []*oraclesv1.Filter{ + { + Key: &oraclesv1.PropertyKey{ + Name: row.oracleSpecProperty(), + Type: row.oracleSpecPropertyType(), + }, + Conditions: []*oraclesv1.Condition{}, + }, + }, + }, + OracleSpecBinding: &types.OracleSpecToFutureBinding{ + SettlementPriceProperty: row.oracleSpecBinding(), + }, + }, + }, + }, + MarginCalculator: &types.MarginCalculator{ + ScalingFactors: &types.ScalingFactors{ + SearchLevel: row.searchLevelFactor(), + InitialMargin: row.initialMarginFactor(), + CollateralRelease: row.collateralReleaseFactor(), + }, + }, + }, + OpeningAuction: openingAuction(row), + TradingModeConfig: &types.Market_Continuous{ + Continuous: &types.ContinuousTrading{}, + }, + PriceMonitoringSettings: &types.PriceMonitoringSettings{ + Parameters: &types.PriceMonitoringParameters{ + Triggers: priceMonitoringTriggers(row), + }, + UpdateFrequency: row.priceMonitoringUpdateFrequency(), + }, + TargetStakeParameters: &types.TargetStakeParameters{ + TimeWindow: 3600, + ScalingFactor: 10, + }, + } + + if row.isLogNormalRiskModel() { + market.TradableInstrument.RiskModel = logNormalRiskModel(row) + } else { + market.TradableInstrument.RiskModel = simpleRiskModel(row) + } + + return market + +} + +func simpleRiskModel(row marketRow) *types.TradableInstrument_SimpleRiskModel { + return &types.TradableInstrument_SimpleRiskModel{ + SimpleRiskModel: &types.SimpleRiskModel{ + Params: &types.SimpleModelParams{ + FactorLong: row.riskAversion(), + FactorShort: row.tau(), + MaxMoveUp: row.mu(), + MinMoveDown: row.r(), + ProbabilityOfTrading: row.probabilityOfTrading(), + }, + }, + } +} + +func logNormalRiskModel(row marketRow) *types.TradableInstrument_LogNormalRiskModel { + return &types.TradableInstrument_LogNormalRiskModel{ + LogNormalRiskModel: &types.LogNormalRiskModel{ + RiskAversionParameter: row.riskAversion(), + Tau: row.tau(), + Params: &types.LogNormalModelParams{ + Mu: row.mu(), + R: row.r(), + Sigma: row.sigma(), + }, + }, + } +} + +func openingAuction(row marketRow) *types.AuctionDuration { + auction := &types.AuctionDuration{ + Duration: row.auctionDuration(), + } + + if auction.Duration <= 0 { + auction = nil + } + return auction +} + +func priceMonitoringTriggers(row marketRow) []*types.PriceMonitoringTrigger { + horizons := row.priceMonitoringHorizons() + probabilities := row.priceMonitoringProbabilities() + durations := row.priceMonitoringDurations() + + if len(horizons) != len(probabilities) || len(horizons) != len(durations) { + panic(fmt.Sprintf( + "horizons (%v), probabilities (%v) and durations (%v) need to have the same number of elements", + len(horizons), + len(probabilities), + len(durations), + )) + } + + triggers := make([]*types.PriceMonitoringTrigger, 0, len(horizons)) + for i := 0; i < len(horizons); i++ { + p := &types.PriceMonitoringTrigger{ + Horizon: horizons[i], + Probability: probabilities[i], + AuctionExtension: durations[i], + } + triggers = append(triggers, p) + } + return triggers +} + +// marketRow wraps the declaration of the properties of an oracle data +type marketRow struct { + row RowWrapper +} + +func (r marketRow) name() string { + return r.row.Str("name") +} + +func (r marketRow) quoteName() string { + return r.row.Str("quote name") +} + +func (r marketRow) asset() string { + return r.row.Str("asset") +} + +func (r marketRow) markPrice() uint64 { + value, err := r.row.U64("mark price") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) riskModel() string { + return r.row.Str("risk model") +} + +func (r marketRow) isLogNormalRiskModel() bool { + return r.riskModel() == "forward" +} + +func (r marketRow) riskAversion() float64 { + value, err := r.row.F64("lamd/long") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) tau() float64 { + value, err := r.row.F64("tau/short") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) mu() float64 { + value, err := r.row.F64("mu/max move up") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) r() float64 { + value, err := r.row.F64("r/min move down") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) sigma() float64 { + value, err := r.row.F64("sigma") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) collateralReleaseFactor() float64 { + value, err := r.row.F64("release factor") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) initialMarginFactor() float64 { + value, err := r.row.F64("initial factor") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) searchLevelFactor() float64 { + value, err := r.row.F64("search factor") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) auctionDuration() int64 { + value, err := r.row.I64("auction duration") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) makerFee() string { + return r.row.Str("maker fee") +} + +func (r marketRow) infrastructureFee() string { + return r.row.Str("infrastructure fee") +} + +func (r marketRow) liquidityFee() string { + return r.row.Str("liquidity fee") +} + +func (r marketRow) priceMonitoringUpdateFrequency() int64 { + value, err := r.row.I64("p. m. update freq.") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) priceMonitoringHorizons() []int64 { + value, err := r.row.I64Slice("p. m. horizons", ",") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) priceMonitoringProbabilities() []float64 { + value, err := r.row.F64Slice("p. m. probs", ",") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) priceMonitoringDurations() []int64 { + value, err := r.row.I64Slice("p. m. durations", ",") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) probabilityOfTrading() float64 { + value, err := r.row.F64("prob. of trading") + if err != nil { + panic(err) + } + return value +} + +func (r marketRow) oracleSpecPubKeys() []string { + return r.row.StrSlice("oracle spec pub. keys", ",") +} + +func (r marketRow) oracleSpecProperty() string { + return r.row.Str("oracle spec property") +} + +func (r marketRow) oracleSpecPropertyType() oraclesv1.PropertyKey_Type { + rawType := r.row.Str("oracle spec property type") + ty, ok := oraclesv1.PropertyKey_Type_value[rawType] + + if !ok { + panic(fmt.Sprintf("invalid oracle property type: %v", rawType)) + } + return oraclesv1.PropertyKey_Type(ty) +} + +func (r marketRow) oracleSpecBinding() string { + return r.row.Str("oracle spec binding") +} diff --git a/integration/table_wrapper_test.go b/integration/table_wrapper_test.go index 6d8728fc36..25a4415104 100644 --- a/integration/table_wrapper_test.go +++ b/integration/table_wrapper_test.go @@ -33,6 +33,10 @@ func (r RowWrapper) Str(name string) string { return r.values[name] } +func (r RowWrapper) StrSlice(name, sep string) []string { + return strings.Split(r.values[name], sep) +} + func (r RowWrapper) U64(name string) (uint64, error) { rawValue := r.values[name] return strconv.ParseUint(rawValue, 10, 0)