Skip to content

Commit

Permalink
Hide Recurring for paper (#694)
Browse files Browse the repository at this point in the history
* processRecurringAO saga: pass not recurring aos

* reset order history on mode change

* improved getOrderHistory selector

* save shown recurring atomics notifications

* AlgoOrdersDetailsModal: improved UX - avoid blinking on close

* update algo and indicators libs

* rc4

* fix property name

* fix trailing stop editing

* fix stop limit editing

* hide recurring for paper mode
  • Loading branch information
dmytroshch authored Sep 12, 2023
1 parent 8d77eb0 commit ef60ce2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/components/OrderForm/OrderForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ class OrderForm extends React.Component {
aoParams,
t,
showAdvancedAlgos,
isPaperTrading,
} = this.props
const { currentMarket } = this.state
const algoOrders = getAOs(t, showAdvancedAlgos)
const algoOrders = getAOs(t, showAdvancedAlgos, false, isPaperTrading)
const orders = getAtomicOrders(t)
resetActiveAOParamsID()

Expand Down Expand Up @@ -395,6 +396,7 @@ class OrderForm extends React.Component {
t,
showAdvancedAlgos,
isAlgoWorkerStarted,
isPaperTrading,
} = this.props
const orders = getAtomicOrders(t)

Expand All @@ -409,7 +411,7 @@ class OrderForm extends React.Component {
isAlgoOrder,
} = this.state

const algoOrders = getAOs(t, showAdvancedAlgos)
const algoOrders = getAOs(t, showAdvancedAlgos, false, isPaperTrading)
const processedAOs = filterAOs(algoOrders, activeMarket)

const apiClientConfigured = apiCredentials?.configured && apiCredentials?.valid
Expand Down
29 changes: 17 additions & 12 deletions src/components/OrderForm/OrderForm.orders.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,32 @@ import memoizeOne from 'memoize-one'
import _values from 'lodash/values'
import _map from 'lodash/map'
import _filter from 'lodash/filter'

import { isElectronApp } from '../../redux/config'
import timeFrames from '../../util/time_frames'

import rawOrders from '../../orders'

const DEV_ONLY_ALGO_ORDERS = [AccumulateDistribute, Recurring]

const getAlgoOrdersForStandalone = (isBeta) => [
...(isBeta ? DEV_ONLY_ALGO_ORDERS : []),
PingPong,
Iceberg,
TWAP,
Bracket,
]
const getAlgoOrdersForStandalone = (isBeta, isPaperTrading) => {
const aos = [
PingPong,
Iceberg,
TWAP,
Bracket,
]
if (isBeta) {
if (!isPaperTrading) {
aos.unshift(Recurring)
}
aos.unshift(AccumulateDistribute)
}
return aos
}

const HOSTED_ALGO_ORDERS = [Iceberg, TWAP]

const getAlgoOrders = (isBeta) => (isElectronApp ? getAlgoOrdersForStandalone(isBeta) : HOSTED_ALGO_ORDERS)
const getAlgoOrders = (isBeta, isPaperTrading) => (isElectronApp ? getAlgoOrdersForStandalone(isBeta, isPaperTrading) : HOSTED_ALGO_ORDERS)

export const getAOs = memoizeOne((t, isBeta, isEditMode = false) => _map(getAlgoOrders(isBeta), (ao) => ao.meta.getUIDef({
export const getAOs = memoizeOne((t, isBeta, isEditMode, isPaperTrading = false) => _map(getAlgoOrders(isBeta, isPaperTrading), (ao) => ao.meta.getUIDef({
timeframes: timeFrames,
i18n: { t, prefix: 'algoOrderForm.' },
isEditMode,
Expand Down
2 changes: 1 addition & 1 deletion src/modals/EditOrderModal/EditOrderModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EditOrderModal = ({
return
}
const updOrder = { ...order }
const algoOrders = getAOs(t, true, !isRelaunching)
const algoOrders = getAOs(t, true, !isRelaunching, false)
let isAlgoOrder = true
let uiDef = _find(
algoOrders,
Expand Down

0 comments on commit ef60ce2

Please sign in to comment.