@@ -2,6 +2,7 @@ import { BaseController, TemplateHelpers } from './base_controller';
22import { ProfileService } from '../profile/profile_service' ;
33import { ProfilePairService } from '../modules/profile_pair_service' ;
44import { OrderParams } from '../profile/types' ;
5+ import { buildTradingViewSymbol } from '../utils/tradingview_util' ;
56import express from 'express' ;
67
78export class OrdersController extends BaseController {
@@ -65,7 +66,7 @@ export class OrdersController extends BaseController {
6566 allPairs,
6667 pairErrors,
6768 ticker,
68- tradingview : this . buildTradingViewSymbol ( profile . exchange , pair ) ,
69+ tradingview : buildTradingViewSymbol ( profile . exchange , pair ) ,
6970 form : {
7071 price : ticker ? ticker . bid : undefined ,
7172 type : 'limit'
@@ -150,7 +151,7 @@ export class OrdersController extends BaseController {
150151 allPairs,
151152 pairErrors,
152153 ticker,
153- tradingview : this . buildTradingViewSymbol ( profile . exchange , pair ) ,
154+ tradingview : buildTradingViewSymbol ( profile . exchange , pair ) ,
154155 form,
155156 asset,
156157 currency,
@@ -202,41 +203,4 @@ export class OrdersController extends BaseController {
202203 currency : parts [ 1 ] || ''
203204 } ;
204205 }
205-
206- /**
207- * Build TradingView symbol from exchange and pair
208- */
209- private buildTradingViewSymbol ( exchange : string , pair : string ) : string {
210- let symbol = pair . replace ( '/' , '' ) ;
211-
212- // Exchange-specific adjustments
213- if ( exchange === 'binance' ) {
214- // For futures, append PERP
215- if ( pair . includes ( ':USDT' ) ) {
216- symbol = symbol . replace ( ':USDT' , 'PERP' ) ;
217- }
218- }
219-
220- if ( exchange === 'bybit' ) {
221- if ( pair . endsWith ( ':USDT' ) ) {
222- symbol = symbol . replace ( ':USDT' , '.P' ) ;
223- } else if ( pair . endsWith ( ':USDC' ) ) {
224- symbol = symbol . replace ( ':USDC' , '.P' ) ;
225- }
226- }
227-
228- // Map exchange names to TradingView format
229- const exchangeMap : Record < string , string > = {
230- 'coinbasepro' : 'coinbase' ,
231- 'coinbase' : 'coinbase' ,
232- 'binance' : 'binance' ,
233- 'bybit' : 'bybit' ,
234- 'kraken' : 'kraken' ,
235- 'bitfinex' : 'bitfinex' ,
236- } ;
237-
238- const tvExchange = exchangeMap [ exchange . toLowerCase ( ) ] || exchange . toLowerCase ( ) ;
239-
240- return `${ tvExchange . toUpperCase ( ) } :${ symbol . toUpperCase ( ) } ` ;
241- }
242206}
0 commit comments