Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class TradeItPortfolioAccountDetailsTableViewManager: NSObject, UITableViewDeleg
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return indexPath.section == SECTIONS.positions.rawValue &&
self.positions?[safe: indexPath.row]?.position?.instrumentType() == .EQUITY_OR_ETF &&
self.positions?[safe: indexPath.row]?.linkedBrokerAccount.orderCapabilities(forInstrument: TradeItTradeInstrumentType.equities) != nil &&
self.selectedPositionIndex != indexPath.row
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ class TradeItPortfolioEquityPositionsTableViewCell: UITableViewCell {
// MARK: private

private func updateTradeButtonVisibility() {
guard let _ = self.selectedPosition?.linkedBrokerAccount.orderCapabilities(forInstrument: TradeItTradeInstrumentType.equities) else {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a tradeable flag in the account response we don't have in the TradeItLinkedBrokerAccount. Should we add and use this flag instead of checking the capabilities?

self.buyButton.isHidden = true
self.sellButton.isHidden = true
return
}

if self.selectedPosition?.position?.instrumentType() == TradeItPositionInstrumentType.EQUITY_OR_ETF {
self.buyButton.isHidden = false
self.sellButton.isHidden = false
Expand Down