티스토리 뷰
[암호화폐 거래소 앱 만들기] Cell에서 사용할 Coin의 한글 이름을 서버에서 제공하지 않는 문제 해결하기
B_log 2022. 1. 26. 09:59
문제 상황
현재가 정보에서 불러온 Entity를(TickerAPI) Cell에서 사용 가능하게 변경해줘야 해요.
문제는 Cell에서 한글 이름을 보여줘야 하는데, 서버 어디에서도 한글 이름을 전해주지 않았어요.
이 문제를 해결하기 위해서는 결국 코인 타입별로 직접 한글 이름을 입력해주어야 하는데 186개에 달하는 코인 이름을 매번 검색해서 넣는 것은 시간이 오래 걸리는 하드 코딩이었어요.
그래서 업무를 줄이기 위해, 업비트의 API에서 호출한 정보를 가지고 겹치는 코인의 경우 이름을 할당해주는 작업을 진행했어요.
문제 해결하기
업비트의 API에서 제공하는 코인과 빗썸에서 제공하는 코인의 종류는 달라요. 그래서 목표는 빗썸에서 제공하는 코인의 종류 중 업비트에서 동시에 제공하는 코인이 있다면 업비트에서 내려받은 한글 이름을 빗썸에 매칭 시키는 것이에요.
우선 업비트의 API 결과물을 살펴볼게요.
[{"market":"KRW-BTC","korean_name":"비트코인","english_name":"Bitcoin"},{"market":"KRW-ETH","korean_name":"이더리움","english_name":"Ethereum"},{"market":"BTC-ETH","korean_name":"이더리움","english_name":"Ethereum"},{"market":"BTC-LTC","korean_name":"라이트코인","english_name":"Litecoin"},{"market":"BTC-XRP","korean_name":"리플","english_name":"Ripple"},{"market":"BTC-ETC","korean_name":"이더리움클래식","english_name":"Ethereum Classic"},{"market":"BTC-OMG","korean_name":"오미세고","english_name":"OmiseGo"},{"market":"BTC-CVC","korean_name":"시빅","english_name":"Civic"},{"market":"BTC-DGB","korean_name":"디지바이트","english_name":"DigiByte"},{"market":"BTC-SC","korean_name":"시아코인","english_name":"Siacoin"},{"market":"BTC-SNT","korean_name":"스테이터스네트워크토큰","english_name":"Status Network Token"},{"market":"BTC-WAVES","korean_name":"웨이브","english_name":"Waves"},{"market":"BTC-NMR","korean_name":"뉴메레르","english_name":"Numeraire"},{"market":"BTC-XEM","korean_name":"넴","english_name":"NEM"},{"market":"BTC-QTUM","korean_name":"퀀텀","english_name":"Qtum"},{"market":"BTC-BAT","korean_name":"베이직어텐션토큰","english_name":"Basic Attention Token"},{"market":"BTC-LSK","korean_name":"리스크","english_name":"Lisk"},{"market":"BTC-STEEM","korean_name":"스팀","english_name":"Steem"},{"market":"BTC-DOGE","korean_name":"도지코인","english_name":"Dogecoin"},{"market":"BTC-BNT","korean_name":"뱅코르","english_name":"Bancor"},{"market":"BTC-XLM","korean_name":"스텔라루멘","english_name":"Lumen"},{"market":"BTC-ARDR","korean_name":"아더","english_name":"Ardor"},{"market":"BTC-ARK","korean_name":"아크","english_name":"Ark"},{"market":"BTC-STORJ","korean_name":"스토리지","english_name":"Storj"},{"market":"BTC-GRS","korean_name":"그로스톨코인","english_name":"Groestlcoin"},{"market":"BTC-REP","korean_name":"어거","english_name":"Augur"},{"market":"BTC-RLC","korean_name":"아이젝","english_name":"iEx.ec"},{"market":"USDT-BTC","korean_name":"비트코인","english_name":"Bitcoin"},{"market":"USDT-ETH","korean_name":"이더리움","english_name":"Ethereum"},{"market":"USDT-LTC","korean_name":"라이트코인","english_name":"Litecoin"},{"market":"USDT-XRP","korean_name":"리플","english_name":"Ripple"},{"market":"USDT-ETC","korean_name":"이더리움클래식","english_name":"Ethereum Classic"},{"market":"KRW-NEO","korean_name":"네오","english_name":"NEO"},{"market":"KRW-MTL","korean_name":"메탈","english_name":"Metal"},{"market":"KRW-LTC","korean_name":"라이트코인","english_name":"Litecoin"},{"market":"KRW-XRP","korean_name":"리플","english_name":"Ripple"},{"market":"KRW-ETC","korean_name":"이더리움클래식","english_name":"Ethereum Classic"},{"market":"KRW-OMG","korean_name":"오미세고","english_name":"OmiseGo"},{"market":"KRW-SNT","korean_name":"스테이터스네트워크토큰","english_name":"Status Network Token"},{"market":"KRW-WAVES","korean_name":"웨이브","english_name":"Waves"},{"market":"KRW-XEM","korean_name":"넴","english_name":"NEM"},{"market":"KRW-QTUM","korean_name":"퀀텀","english_name":"Qtum"},{"market":"KRW-LSK","korean_name":"리스크","english_name":"Lisk"},{"market":"KRW-STEEM","korean_name":"스팀","english_name":"Steem"},{"market":"KRW-XLM","korean_name":"스텔라루멘","english_name":"Lumen"},{"market":"KRW-ARDR","korean_name":"아더","english_name":"Ardor"},{"market":"KRW-ARK","korean_name":"아크","english_name":"Ark"},{"market":"KRW-STORJ","korean_name":"스토리지","english_name":"Storj"},{"market":"KRW-GRS","korean_name":"그로스톨코인","english_name":"Groestlcoin"},{"market":"KRW-REP","korean_name":"어거","english_name":"Augur"},{"market":"KRW-ADA","korean_name":"에이다","english_name":"Ada"},{"market":"BTC-ADA","korean_name":"에이다","english_name":"Ada"},{"market":"BTC-MANA","korean_name":"디센트럴랜드","english_name":"Decentraland"},{"market":"USDT-OMG","korean_name":"오미세고","english_name":"OmiseGo"},{"market":"KRW-SBD","korean_name":"스팀달러","english_name":"SteemDollars"},{"market":"BTC-SBD","korean_name":"스팀달러","english_name":"SteemDollars"},{"market":"KRW-POWR","korean_name":"파워렛저","english_name":"Power ledger"},{"market":"BTC-POWR","korean_name":"파워렛저","english_name":"Power ledger"},{"market":"KRW-BTG","korean_name":"비트코인골드","english_name":"Bitcoin Gold"},{"market":"USDT-ADA","korean_name":"에이다","english_name":"Ada"},{"market":"BTC-DNT","korean_name":"디스트릭트0x","english_name":"district0x"},{"market":"BTC-ZRX","korean_name":"제로엑스","english_name":"0x Protocol"},{"market":"BTC-TRX","korean_name":"트론","english_name":"TRON"},{"market":"BTC-TUSD","korean_name":"트루USD","english_name":"TrueUSD"},{"market":"BTC-LRC","korean_name":"루프링","english_name":"Loopring"},{"market":"KRW-ICX","korean_name":"아이콘","english_name":"Icon"},{"market":"KRW-EOS","korean_name":"이오스","english_name":"EOS"},{"market":"USDT-TUSD","korean_name":"트루USD","english_name":"TrueUSD"},{"market":"KRW-TRX","korean_name":"트론","english_name":"TRON"},{"market":"BTC-POLY","korean_name":"폴리매쓰","english_name":"Polymath"},{"market":"USDT-SC","korean_name":"시아코인","english_name":"Siacoin"},{"market":"USDT-TRX","korean_name":"트론","english_name":"TRON"},{"market":"KRW-SC","korean_name":"시아코인","english_name":"Siacoin"},{"market":"KRW-ONT","korean_name":"온톨로지","english_name":"Ontology"},{"market":"KRW-ZIL","korean_name":"질리카","english_name":"Zilliqa"},{"market":"KRW-POLY","korean_name":"폴리매쓰","english_name":"Polymath"},{"market":"KRW-ZRX","korean_name":"제로엑스","english_name":"0x Protocol"},{"market":"KRW-LOOM","korean_name":"룸네트워크","english_name":"Loom Network"},{"market":"BTC-BCH","korean_name":"비트코인캐시","english_name":"Bitcoin Cash"},{"market":"USDT-BCH","korean_name":"비트코인캐시","english_name":"Bitcoin Cash"},{"market":"KRW-BCH","korean_name":"비트코인캐시","english_name":"Bitcoin Cash"},{"market":"BTC-MFT","korean_name":"메인프레임","english_name":"Mainframe"},{"market":"BTC-LOOM","korean_name":"룸네트워크","english_name":"Loom Network"},{"market":"KRW-BAT","korean_name":"베이직어텐션토큰","english_name":"Basic Attention Token"},{"market":"KRW-IOST","korean_name":"아이오에스티","english_name":"IOST"},{"market":"BTC-RFR","korean_name":"리퍼리움","english_name":"Refereum"},{"market":"KRW-RFR","korean_name":"리퍼리움","english_name":"Refereum"},{"market":"USDT-DGB","korean_name":"디지바이트","english_name":"DigiByte"},{"market":"KRW-CVC","korean_name":"시빅","english_name":"Civic"},{"market":"KRW-IQ","korean_name":"에브리피디아","english_name":"Everipedia"},{"market":"KRW-IOTA","korean_name":"아이오타","english_name":"IOTA"},{"market":"BTC-RVN","korean_name":"레이븐코인","english_name":"Ravencoin"},{"market":"BTC-GO","korean_name":"고체인","english_name":"GoChain"},{"market":"BTC-UPP","korean_name":"센티넬프로토콜","english_name":"Sentinel Protocol"},{"market":"BTC-ENJ","korean_name":"엔진코인","english_name":"Enjin"},{"market":"KRW-MFT","korean_name":"메인프레임","english_name":"Mainframe"},{"market":"KRW-ONG","korean_name":"온톨로지가스","english_name":"ONG"},{"market":"KRW-GAS","korean_name":"가스","english_name":"GAS"},{"market":"BTC-MTL","korean_name":"메탈","english_name":"Metal"},{"market":"KRW-UPP","korean_name":"센티넬프로토콜","english_name":"Sentinel Protocol"},{"market":"KRW-ELF","korean_name":"엘프","english_name":"aelf"},{"market":"USDT-DOGE","korean_name":"도지코인","english_name":"Dogecoin"},{"market":"USDT-ZRX","korean_name":"제로엑스","english_name":"0x Protocol"},{"market":"USDT-RVN","korean_name":"레이븐코인","english_name":"Ravencoin"},{"market":"USDT-BAT","korean_name":"베이직어텐션토큰","english_name":"Basic Attention Token"},{"market":"KRW-KNC","korean_name":"카이버네트워크","english_name":"Kyber Network"},{"market":"BTC-MOC","korean_name":"모스코인","english_name":"Moss Coin"},{"market":"BTC-ZIL","korean_name":"질리카","english_name":"Zilliqa"},{"market":"KRW-BSV","korean_name":"비트코인에스브이","english_name":"Bitcoin SV"},{"market":"BTC-BSV","korean_name":"비트코인에스브이","english_name":"Bitcoin SV"},{"market":"BTC-IOST","korean_name":"아이오에스티","english_name":"IOST"},{"market":"KRW-THETA","korean_name":"쎄타토큰","english_name":"Theta Token"},{"market":"BTC-DENT","korean_name":"덴트","english_name":"Dent"},{"market":"KRW-QKC","korean_name":"쿼크체인","english_name":"QuarkChain"},{"market":"BTC-ELF","korean_name":"엘프","english_name":"aelf"},{"market":"KRW-BTT","korean_name":"비트토렌트","english_name":"BitTorrent"},{"market":"BTC-IOTX","korean_name":"아이오텍스","english_name":"IoTeX"},{"market":"BTC-SOLVE","korean_name":"솔브케어","english_name":"Solve.Care"},{"market":"BTC-NKN","korean_name":"엔케이엔","english_name":"NKN"},{"market":"BTC-META","korean_name":"메타디움","english_name":"Metadium"},{"market":"KRW-MOC","korean_name":"모스코인","english_name":"Moss Coin"},{"market":"BTC-ANKR","korean_name":"앵커","english_name":"Ankr"},{"market":"BTC-CRO","korean_name":"크립토닷컴체인","english_name":"Crypto.com Chain"},{"market":"KRW-ENJ","korean_name":"엔진코인","english_name":"Enjin"},{"market":"KRW-TFUEL","korean_name":"쎄타퓨엘","english_name":"Theta Fuel"},{"market":"KRW-MANA","korean_name":"디센트럴랜드","english_name":"Decentraland"},{"market":"KRW-ANKR","korean_name":"앵커","english_name":"Ankr"},{"market":"BTC-ORBS","korean_name":"오브스","english_name":"Orbs"},{"market":"BTC-AERGO","korean_name":"아르고","english_name":"Aergo"},{"market":"KRW-AERGO","korean_name":"아르고","english_name":"Aergo"},{"market":"KRW-ATOM","korean_name":"코스모스","english_name":"Cosmos"},{"market":"KRW-TT","korean_name":"썬더코어","english_name":"ThunderCore"},{"market":"KRW-CRE","korean_name":"캐리프로토콜","english_name":"Carry Protocol"},{"market":"BTC-ATOM","korean_name":"코스모스","english_name":"Cosmos"},{"market":"BTC-STPT","korean_name":"에스티피","english_name":"Standard Tokenization Protocol"},{"market":"KRW-MBL","korean_name":"무비블록","english_name":"MovieBloc"},{"market":"BTC-EOS","korean_name":"이오스","english_name":"EOS"},{"market":"BTC-LUNA","korean_name":"루나","english_name":"Luna"},{"market":"BTC-DAI","korean_name":"다이","english_name":"Dai"},{"market":"BTC-MKR","korean_name":"메이커","english_name":"Maker"},{"market":"BTC-BORA","korean_name":"보라","english_name":"BORA"},{"market":"KRW-WAXP","korean_name":"왁스","english_name":"WAX"},{"market":"BTC-WAXP","korean_name":"왁스","english_name":"WAX"},{"market":"KRW-HBAR","korean_name":"헤데라","english_name":"Hedera"},{"market":"KRW-MED","korean_name":"메디블록","english_name":"MediBloc"},{"market":"BTC-MED","korean_name":"메디블록","english_name":"MediBloc"},{"market":"BTC-MLK","korean_name":"밀크","english_name":"MiL.k"},{"market":"KRW-MLK","korean_name":"밀크","english_name":"MiL.k"},{"market":"KRW-STPT","korean_name":"에스티피","english_name":"Standard Tokenization Protocol"},{"market":"BTC-VET","korean_name":"비체인","english_name":"VeChain"},{"market":"KRW-ORBS","korean_name":"오브스","english_name":"Orbs"},{"market":"BTC-CHZ","korean_name":"칠리즈","english_name":"Chiliz"},{"market":"KRW-VET","korean_name":"비체인","english_name":"VeChain"},{"market":"BTC-FX","korean_name":"펑션엑스","english_name":"Function X"},{"market":"BTC-OGN","korean_name":"오리진프로토콜","english_name":"Origin Protocol"},{"market":"KRW-CHZ","korean_name":"칠리즈","english_name":"Chiliz"},{"market":"BTC-XTZ","korean_name":"테조스","english_name":"Tezos"},{"market":"BTC-HIVE","korean_name":"하이브","english_name":"Hive"},{"market":"BTC-HBD","korean_name":"하이브달러","english_name":"Hive Dollar"},{"market":"BTC-OBSR","korean_name":"옵저버","english_name":"Observer"},{"market":"BTC-DKA","korean_name":"디카르고","english_name":"dKargo"},{"market":"KRW-STMX","korean_name":"스톰엑스","english_name":"StormX"},{"market":"BTC-STMX","korean_name":"스톰엑스","english_name":"StormX"},{"market":"BTC-AHT","korean_name":"아하토큰","english_name":"AhaToken"},{"market":"BTC-PCI","korean_name":"페이코인","english_name":"PayCoin"},{"market":"KRW-DKA","korean_name":"디카르고","english_name":"dKargo"},{"market":"BTC-LINK","korean_name":"체인링크","english_name":"Chainlink"},{"market":"KRW-HIVE","korean_name":"하이브","english_name":"Hive"},{"market":"KRW-KAVA","korean_name":"카바","english_name":"Kava"},{"market":"BTC-KAVA","korean_name":"카바","english_name":"Kava"},{"market":"KRW-AHT","korean_name":"아하토큰","english_name":"AhaToken"},{"market":"KRW-LINK","korean_name":"체인링크","english_name":"Chainlink"},{"market":"KRW-XTZ","korean_name":"테조스","english_name":"Tezos"},{"market":"KRW-BORA","korean_name":"보라","english_name":"BORA"},{"market":"BTC-JST","korean_name":"저스트","english_name":"JUST"},{"market":"BTC-CHR","korean_name":"크로미아","english_name":"Chromia"},{"market":"BTC-DAD","korean_name":"다드","english_name":"DAD"},{"market":"BTC-TON","korean_name":"톤","english_name":"TON"},{"market":"KRW-JST","korean_name":"저스트","english_name":"JUST"},{"market":"BTC-CTSI","korean_name":"카르테시","english_name":"Cartesi"},{"market":"BTC-DOT","korean_name":"폴카닷","english_name":"Polkadot"},{"market":"KRW-CRO","korean_name":"크립토닷컴체인","english_name":"Crypto.com Chain"},{"market":"BTC-COMP","korean_name":"컴파운드","english_name":"Compound"},{"market":"BTC-SXP","korean_name":"스와이프","english_name":"Swipe"},{"market":"BTC-HUNT","korean_name":"헌트","english_name":"HUNT"},{"market":"KRW-TON","korean_name":"톤","english_name":"TON"},{"market":"BTC-ONIT","korean_name":"온버프","english_name":"ONBUFF"},{"market":"BTC-CRV","korean_name":"커브","english_name":"Curve"},{"market":"BTC-ALGO","korean_name":"알고랜드","english_name":"Algorand"},{"market":"BTC-RSR","korean_name":"리저브라이트","english_name":"Reserve Rights"},{"market":"KRW-SXP","korean_name":"스와이프","english_name":"Swipe"},{"market":"BTC-OXT","korean_name":"오키드","english_name":"Orchid"},{"market":"BTC-PLA","korean_name":"플레이댑","english_name":"PlayDapp"},{"market":"KRW-HUNT","korean_name":"헌트","english_name":"HUNT"},{"market":"BTC-MARO","korean_name":"마로","english_name":"Maro"},{"market":"BTC-SAND","korean_name":"샌드박스","english_name":"The Sandbox"},{"market":"BTC-SUN","korean_name":"썬","english_name":"SUN"},{"market":"KRW-PLA","korean_name":"플레이댑","english_name":"PlayDapp"},{"market":"KRW-DOT","korean_name":"폴카닷","english_name":"Polkadot"},{"market":"BTC-SRM","korean_name":"세럼","english_name":"Serum"},{"market":"BTC-QTCON","korean_name":"퀴즈톡","english_name":"Quiztok"},{"market":"BTC-MVL","korean_name":"엠블","english_name":"MVL"},{"market":"KRW-SRM","korean_name":"세럼","english_name":"Serum"},{"market":"KRW-MVL","korean_name":"엠블","english_name":"MVL"},{"market":"BTC-GXC","korean_name":"지엑스체인","english_name":"GXChain"},{"market":"BTC-AQT","korean_name":"알파쿼크","english_name":"Alpha Quark Token"},{"market":"BTC-AXS","korean_name":"엑시인피니티","english_name":"Axie Infinity"},{"market":"BTC-STRAX","korean_name":"스트라티스","english_name":"Stratis"},{"market":"KRW-STRAX","korean_name":"스트라티스","english_name":"Stratis"},{"market":"KRW-AQT","korean_name":"알파쿼크","english_name":"Alpha Quark Token"},{"market":"BTC-GLM","korean_name":"골렘","english_name":"Golem"},{"market":"KRW-GLM","korean_name":"골렘","english_name":"Golem"},{"market":"BTC-FCT2","korean_name":"피르마체인","english_name":"FirmaChain"},{"market":"BTC-SSX","korean_name":"썸씽","english_name":"SOMESING"},{"market":"KRW-SSX","korean_name":"썸씽","english_name":"SOMESING"},{"market":"KRW-META","korean_name":"메타디움","english_name":"Metadium"},{"market":"KRW-FCT2","korean_name":"피르마체인","english_name":"FirmaChain"},{"market":"BTC-FIL","korean_name":"파일코인","english_name":"Filecoin"},{"market":"BTC-UNI","korean_name":"유니스왑","english_name":"Uniswap"},{"market":"BTC-BASIC","korean_name":"베이직","english_name":"Basic"},{"market":"BTC-INJ","korean_name":"인젝티브프로토콜","english_name":"Injective Protocol"},{"market":"BTC-PROM","korean_name":"프로메테우스","english_name":"Prometeus"},{"market":"BTC-VAL","korean_name":"밸리디티","english_name":"Validity"},{"market":"BTC-PSG","korean_name":"파리생제르맹","english_name":"Paris Saint-Germain Fan Token"},{"market":"BTC-JUV","korean_name":"유벤투스","english_name":"Juventus Fan Token"},{"market":"BTC-CBK","korean_name":"코박토큰","english_name":"Cobak Token"},{"market":"BTC-FOR","korean_name":"포튜브","english_name":"ForTube"},{"market":"KRW-CBK","korean_name":"코박토큰","english_name":"Cobak Token"},{"market":"BTC-BFC","korean_name":"바이프로스트","english_name":"Bifrost"},{"market":"BTC-LINA","korean_name":"리니어파이낸스","english_name":"Linear"},{"market":"BTC-HUM","korean_name":"휴먼스케이프","english_name":"Humanscape"},{"market":"BTC-CELO","korean_name":"셀로","english_name":"Celo"},{"market":"KRW-SAND","korean_name":"샌드박스","english_name":"The Sandbox"},{"market":"KRW-HUM","korean_name":"휴먼스케이프","english_name":"Humanscape"},{"market":"BTC-IQ","korean_name":"에브리피디아","english_name":"Everipedia"},{"market":"BTC-STX","korean_name":"스택스","english_name":"Stacks"},{"market":"KRW-DOGE","korean_name":"도지코인","english_name":"Dogecoin"},{"market":"BTC-NEAR","korean_name":"니어프로토콜","english_name":"NEAR Protocol"},{"market":"BTC-AUCTION","korean_name":"바운스토큰","english_name":"Bounce"},{"market":"BTC-DAWN","korean_name":"던프로토콜","english_name":"Dawn Protocol"},{"market":"BTC-FLOW","korean_name":"플로우","english_name":"Flow"},{"market":"BTC-STRK","korean_name":"스트라이크","english_name":"Strike"},{"market":"KRW-STRK","korean_name":"스트라이크","english_name":"Strike"},{"market":"BTC-PUNDIX","korean_name":"펀디엑스","english_name":"Pundi X"},{"market":"KRW-PUNDIX","korean_name":"펀디엑스","english_name":"Pundi X"},{"market":"KRW-FLOW","korean_name":"플로우","english_name":"Flow"},{"market":"KRW-DAWN","korean_name":"던프로토콜","english_name":"Dawn Protocol"},{"market":"KRW-AXS","korean_name":"엑시인피니티","english_name":"Axie Infinity"},{"market":"KRW-STX","korean_name":"스택스","english_name":"Stacks"},{"market":"BTC-GRT","korean_name":"그래프","english_name":"The Graph"},{"market":"BTC-SNX","korean_name":"신세틱스","english_name":"Synthetix"},{"market":"BTC-USDP","korean_name":"팍스달러","english_name":"Pax Dollar"},{"market":"KRW-XEC","korean_name":"이캐시","english_name":"eCash"},{"market":"KRW-SOL","korean_name":"솔라나","english_name":"Solana"},{"market":"BTC-SOL","korean_name":"솔라나","english_name":"Solana"},{"market":"KRW-MATIC","korean_name":"폴리곤","english_name":"Polygon"},{"market":"BTC-MATIC","korean_name":"폴리곤","english_name":"Polygon"},{"market":"KRW-NU","korean_name":"누사이퍼","english_name":"Nucypher"},{"market":"BTC-NU","korean_name":"누사이퍼","english_name":"Nucypher"},{"market":"KRW-AAVE","korean_name":"에이브","english_name":"Aave"},{"market":"KRW-1INCH","korean_name":"1인치네트워크","english_name":"1inch Network"},{"market":"BTC-AAVE","korean_name":"에이브","english_name":"Aave"},{"market":"BTC-1INCH","korean_name":"1인치네트워크","english_name":"1inch Network"},{"market":"BTC-MASK","korean_name":"마스크네트워크","english_name":"Mask Network"},{"market":"KRW-ALGO","korean_name":"알고랜드","english_name":"Algorand"},{"market":"BTC-AUDIO","korean_name":"오디우스","english_name":"Audius"},{"market":"KRW-NEAR","korean_name":"니어프로토콜","english_name":"NEAR Protocol"},{"market":"BTC-YGG","korean_name":"일드길드게임즈","english_name":"Yield Guild Games"},{"market":"BTC-GTC","korean_name":"깃코인","english_name":"Gitcoin"},{"market":"BTC-OCEAN","korean_name":"오션프로토콜","english_name":"Ocean Protocol"},{"market":"BTC-CTC","korean_name":"크레딧코인","english_name":"Creditcoin"},{"market":"BTC-LPT","korean_name":"라이브피어","english_name":"Livepeer"},{"market":"KRW-WEMIX","korean_name":"위믹스","english_name":"Wemix"},{"market":"BTC-WEMIX","korean_name":"위믹스","english_name":"Wemix"}]
로직을 생각해보면 우선 빗썸의 코인 목록을 순회해요.
그리고 그 순회 안에서 다시 업비트의 코인 목록을 순회해요. 업비트의 코인 목록 중 market에서 "-" 뒤의 값이 빗썸 코인 목록과 같은 경우 업비트의 코인 목록 중 korean_name을 할당해주고, 아닌 경우 "없음"으로 표시해줘요.
코인 목록의 수가 다르기 때문에 연산 속도는 O(N*M)이 될 것이라고 생각했고, 각각 1000개 이하의 개수를 가지고 있어 속도에 문제가 없을 것이라고 판단했어요.
결과 코드
결과 코드는 아래와 같아요 :)
import Foundation
let upBitData = """
[{"market":"KRW-BTC","korean_name":"비트코인","english_name":"Bitcoin"},{"market":"KRW-ETH","korean_name":"이더리움","english_name":"Ethereum"},{"market":"BTC-ETH","korean_name":"이더리움","english_name":"Ethereum"},{"market":"BTC-LTC","korean_name":"라이트코인","english_name":"Litecoin"},{"market":"BTC-XRP","korean_name":"리플","english_name":"Ripple"},{"market":"BTC-ETC","korean_name":"이더리움클래식","english_name":"Ethereum Classic"},{"market":"BTC-OMG","korean_name":"오미세고","english_name":"OmiseGo"},{"market":"BTC-CVC","korean_name":"시빅","english_name":"Civic"},{"market":"BTC-DGB","korean_name":"디지바이트","english_name":"DigiByte"},{"market":"BTC-SC","korean_name":"시아코인","english_name":"Siacoin"},{"market":"BTC-SNT","korean_name":"스테이터스네트워크토큰","english_name":"Status Network Token"},{"market":"BTC-WAVES","korean_name":"웨이브","english_name":"Waves"},{"market":"BTC-NMR","korean_name":"뉴메레르","english_name":"Numeraire"},{"market":"BTC-XEM","korean_name":"넴","english_name":"NEM"},{"market":"BTC-QTUM","korean_name":"퀀텀","english_name":"Qtum"},{"market":"BTC-BAT","korean_name":"베이직어텐션토큰","english_name":"Basic Attention Token"},{"market":"BTC-LSK","korean_name":"리스크","english_name":"Lisk"},{"market":"BTC-STEEM","korean_name":"스팀","english_name":"Steem"},{"market":"BTC-DOGE","korean_name":"도지코인","english_name":"Dogecoin"},{"market":"BTC-BNT","korean_name":"뱅코르","english_name":"Bancor"},{"market":"BTC-XLM","korean_name":"스텔라루멘","english_name":"Lumen"},{"market":"BTC-ARDR","korean_name":"아더","english_name":"Ardor"},{"market":"BTC-ARK","korean_name":"아크","english_name":"Ark"},{"market":"BTC-STORJ","korean_name":"스토리지","english_name":"Storj"},{"market":"BTC-GRS","korean_name":"그로스톨코인","english_name":"Groestlcoin"},{"market":"BTC-REP","korean_name":"어거","english_name":"Augur"},{"market":"BTC-RLC","korean_name":"아이젝","english_name":"iEx.ec"},{"market":"USDT-BTC","korean_name":"비트코인","english_name":"Bitcoin"},{"market":"USDT-ETH","korean_name":"이더리움","english_name":"Ethereum"},{"market":"USDT-LTC","korean_name":"라이트코인","english_name":"Litecoin"},{"market":"USDT-XRP","korean_name":"리플","english_name":"Ripple"},{"market":"USDT-ETC","korean_name":"이더리움클래식","english_name":"Ethereum Classic"},{"market":"KRW-NEO","korean_name":"네오","english_name":"NEO"},{"market":"KRW-MTL","korean_name":"메탈","english_name":"Metal"},{"market":"KRW-LTC","korean_name":"라이트코인","english_name":"Litecoin"},{"market":"KRW-XRP","korean_name":"리플","english_name":"Ripple"},{"market":"KRW-ETC","korean_name":"이더리움클래식","english_name":"Ethereum Classic"},{"market":"KRW-OMG","korean_name":"오미세고","english_name":"OmiseGo"},{"market":"KRW-SNT","korean_name":"스테이터스네트워크토큰","english_name":"Status Network Token"},{"market":"KRW-WAVES","korean_name":"웨이브","english_name":"Waves"},{"market":"KRW-XEM","korean_name":"넴","english_name":"NEM"},{"market":"KRW-QTUM","korean_name":"퀀텀","english_name":"Qtum"},{"market":"KRW-LSK","korean_name":"리스크","english_name":"Lisk"},{"market":"KRW-STEEM","korean_name":"스팀","english_name":"Steem"},{"market":"KRW-XLM","korean_name":"스텔라루멘","english_name":"Lumen"},{"market":"KRW-ARDR","korean_name":"아더","english_name":"Ardor"},{"market":"KRW-ARK","korean_name":"아크","english_name":"Ark"},{"market":"KRW-STORJ","korean_name":"스토리지","english_name":"Storj"},{"market":"KRW-GRS","korean_name":"그로스톨코인","english_name":"Groestlcoin"},{"market":"KRW-REP","korean_name":"어거","english_name":"Augur"},{"market":"KRW-ADA","korean_name":"에이다","english_name":"Ada"},{"market":"BTC-ADA","korean_name":"에이다","english_name":"Ada"},{"market":"BTC-MANA","korean_name":"디센트럴랜드","english_name":"Decentraland"},{"market":"USDT-OMG","korean_name":"오미세고","english_name":"OmiseGo"},{"market":"KRW-SBD","korean_name":"스팀달러","english_name":"SteemDollars"},{"market":"BTC-SBD","korean_name":"스팀달러","english_name":"SteemDollars"},{"market":"KRW-POWR","korean_name":"파워렛저","english_name":"Power ledger"},{"market":"BTC-POWR","korean_name":"파워렛저","english_name":"Power ledger"},{"market":"KRW-BTG","korean_name":"비트코인골드","english_name":"Bitcoin Gold"},{"market":"USDT-ADA","korean_name":"에이다","english_name":"Ada"},{"market":"BTC-DNT","korean_name":"디스트릭트0x","english_name":"district0x"},{"market":"BTC-ZRX","korean_name":"제로엑스","english_name":"0x Protocol"},{"market":"BTC-TRX","korean_name":"트론","english_name":"TRON"},{"market":"BTC-TUSD","korean_name":"트루USD","english_name":"TrueUSD"},{"market":"BTC-LRC","korean_name":"루프링","english_name":"Loopring"},{"market":"KRW-ICX","korean_name":"아이콘","english_name":"Icon"},{"market":"KRW-EOS","korean_name":"이오스","english_name":"EOS"},{"market":"USDT-TUSD","korean_name":"트루USD","english_name":"TrueUSD"},{"market":"KRW-TRX","korean_name":"트론","english_name":"TRON"},{"market":"BTC-POLY","korean_name":"폴리매쓰","english_name":"Polymath"},{"market":"USDT-SC","korean_name":"시아코인","english_name":"Siacoin"},{"market":"USDT-TRX","korean_name":"트론","english_name":"TRON"},{"market":"KRW-SC","korean_name":"시아코인","english_name":"Siacoin"},{"market":"KRW-ONT","korean_name":"온톨로지","english_name":"Ontology"},{"market":"KRW-ZIL","korean_name":"질리카","english_name":"Zilliqa"},{"market":"KRW-POLY","korean_name":"폴리매쓰","english_name":"Polymath"},{"market":"KRW-ZRX","korean_name":"제로엑스","english_name":"0x Protocol"},{"market":"KRW-LOOM","korean_name":"룸네트워크","english_name":"Loom Network"},{"market":"BTC-BCH","korean_name":"비트코인캐시","english_name":"Bitcoin Cash"},{"market":"USDT-BCH","korean_name":"비트코인캐시","english_name":"Bitcoin Cash"},{"market":"KRW-BCH","korean_name":"비트코인캐시","english_name":"Bitcoin Cash"},{"market":"BTC-MFT","korean_name":"메인프레임","english_name":"Mainframe"},{"market":"BTC-LOOM","korean_name":"룸네트워크","english_name":"Loom Network"},{"market":"KRW-BAT","korean_name":"베이직어텐션토큰","english_name":"Basic Attention Token"},{"market":"KRW-IOST","korean_name":"아이오에스티","english_name":"IOST"},{"market":"BTC-RFR","korean_name":"리퍼리움","english_name":"Refereum"},{"market":"KRW-RFR","korean_name":"리퍼리움","english_name":"Refereum"},{"market":"USDT-DGB","korean_name":"디지바이트","english_name":"DigiByte"},{"market":"KRW-CVC","korean_name":"시빅","english_name":"Civic"},{"market":"KRW-IQ","korean_name":"에브리피디아","english_name":"Everipedia"},{"market":"KRW-IOTA","korean_name":"아이오타","english_name":"IOTA"},{"market":"BTC-RVN","korean_name":"레이븐코인","english_name":"Ravencoin"},{"market":"BTC-GO","korean_name":"고체인","english_name":"GoChain"},{"market":"BTC-UPP","korean_name":"센티넬프로토콜","english_name":"Sentinel Protocol"},{"market":"BTC-ENJ","korean_name":"엔진코인","english_name":"Enjin"},{"market":"KRW-MFT","korean_name":"메인프레임","english_name":"Mainframe"},{"market":"KRW-ONG","korean_name":"온톨로지가스","english_name":"ONG"},{"market":"KRW-GAS","korean_name":"가스","english_name":"GAS"},{"market":"BTC-MTL","korean_name":"메탈","english_name":"Metal"},{"market":"KRW-UPP","korean_name":"센티넬프로토콜","english_name":"Sentinel Protocol"},{"market":"KRW-ELF","korean_name":"엘프","english_name":"aelf"},{"market":"USDT-DOGE","korean_name":"도지코인","english_name":"Dogecoin"},{"market":"USDT-ZRX","korean_name":"제로엑스","english_name":"0x Protocol"},{"market":"USDT-RVN","korean_name":"레이븐코인","english_name":"Ravencoin"},{"market":"USDT-BAT","korean_name":"베이직어텐션토큰","english_name":"Basic Attention Token"},{"market":"KRW-KNC","korean_name":"카이버네트워크","english_name":"Kyber Network"},{"market":"BTC-MOC","korean_name":"모스코인","english_name":"Moss Coin"},{"market":"BTC-ZIL","korean_name":"질리카","english_name":"Zilliqa"},{"market":"KRW-BSV","korean_name":"비트코인에스브이","english_name":"Bitcoin SV"},{"market":"BTC-BSV","korean_name":"비트코인에스브이","english_name":"Bitcoin SV"},{"market":"BTC-IOST","korean_name":"아이오에스티","english_name":"IOST"},{"market":"KRW-THETA","korean_name":"쎄타토큰","english_name":"Theta Token"},{"market":"BTC-DENT","korean_name":"덴트","english_name":"Dent"},{"market":"KRW-QKC","korean_name":"쿼크체인","english_name":"QuarkChain"},{"market":"BTC-ELF","korean_name":"엘프","english_name":"aelf"},{"market":"KRW-BTT","korean_name":"비트토렌트","english_name":"BitTorrent"},{"market":"BTC-IOTX","korean_name":"아이오텍스","english_name":"IoTeX"},{"market":"BTC-SOLVE","korean_name":"솔브케어","english_name":"Solve.Care"},{"market":"BTC-NKN","korean_name":"엔케이엔","english_name":"NKN"},{"market":"BTC-META","korean_name":"메타디움","english_name":"Metadium"},{"market":"KRW-MOC","korean_name":"모스코인","english_name":"Moss Coin"},{"market":"BTC-ANKR","korean_name":"앵커","english_name":"Ankr"},{"market":"BTC-CRO","korean_name":"크립토닷컴체인","english_name":"Crypto.com Chain"},{"market":"KRW-ENJ","korean_name":"엔진코인","english_name":"Enjin"},{"market":"KRW-TFUEL","korean_name":"쎄타퓨엘","english_name":"Theta Fuel"},{"market":"KRW-MANA","korean_name":"디센트럴랜드","english_name":"Decentraland"},{"market":"KRW-ANKR","korean_name":"앵커","english_name":"Ankr"},{"market":"BTC-ORBS","korean_name":"오브스","english_name":"Orbs"},{"market":"BTC-AERGO","korean_name":"아르고","english_name":"Aergo"},{"market":"KRW-AERGO","korean_name":"아르고","english_name":"Aergo"},{"market":"KRW-ATOM","korean_name":"코스모스","english_name":"Cosmos"},{"market":"KRW-TT","korean_name":"썬더코어","english_name":"ThunderCore"},{"market":"KRW-CRE","korean_name":"캐리프로토콜","english_name":"Carry Protocol"},{"market":"BTC-ATOM","korean_name":"코스모스","english_name":"Cosmos"},{"market":"BTC-STPT","korean_name":"에스티피","english_name":"Standard Tokenization Protocol"},{"market":"KRW-MBL","korean_name":"무비블록","english_name":"MovieBloc"},{"market":"BTC-EOS","korean_name":"이오스","english_name":"EOS"},{"market":"BTC-LUNA","korean_name":"루나","english_name":"Luna"},{"market":"BTC-DAI","korean_name":"다이","english_name":"Dai"},{"market":"BTC-MKR","korean_name":"메이커","english_name":"Maker"},{"market":"BTC-BORA","korean_name":"보라","english_name":"BORA"},{"market":"KRW-WAXP","korean_name":"왁스","english_name":"WAX"},{"market":"BTC-WAXP","korean_name":"왁스","english_name":"WAX"},{"market":"KRW-HBAR","korean_name":"헤데라","english_name":"Hedera"},{"market":"KRW-MED","korean_name":"메디블록","english_name":"MediBloc"},{"market":"BTC-MED","korean_name":"메디블록","english_name":"MediBloc"},{"market":"BTC-MLK","korean_name":"밀크","english_name":"MiL.k"},{"market":"KRW-MLK","korean_name":"밀크","english_name":"MiL.k"},{"market":"KRW-STPT","korean_name":"에스티피","english_name":"Standard Tokenization Protocol"},{"market":"BTC-VET","korean_name":"비체인","english_name":"VeChain"},{"market":"KRW-ORBS","korean_name":"오브스","english_name":"Orbs"},{"market":"BTC-CHZ","korean_name":"칠리즈","english_name":"Chiliz"},{"market":"KRW-VET","korean_name":"비체인","english_name":"VeChain"},{"market":"BTC-FX","korean_name":"펑션엑스","english_name":"Function X"},{"market":"BTC-OGN","korean_name":"오리진프로토콜","english_name":"Origin Protocol"},{"market":"KRW-CHZ","korean_name":"칠리즈","english_name":"Chiliz"},{"market":"BTC-XTZ","korean_name":"테조스","english_name":"Tezos"},{"market":"BTC-HIVE","korean_name":"하이브","english_name":"Hive"},{"market":"BTC-HBD","korean_name":"하이브달러","english_name":"Hive Dollar"},{"market":"BTC-OBSR","korean_name":"옵저버","english_name":"Observer"},{"market":"BTC-DKA","korean_name":"디카르고","english_name":"dKargo"},{"market":"KRW-STMX","korean_name":"스톰엑스","english_name":"StormX"},{"market":"BTC-STMX","korean_name":"스톰엑스","english_name":"StormX"},{"market":"BTC-AHT","korean_name":"아하토큰","english_name":"AhaToken"},{"market":"BTC-PCI","korean_name":"페이코인","english_name":"PayCoin"},{"market":"KRW-DKA","korean_name":"디카르고","english_name":"dKargo"},{"market":"BTC-LINK","korean_name":"체인링크","english_name":"Chainlink"},{"market":"KRW-HIVE","korean_name":"하이브","english_name":"Hive"},{"market":"KRW-KAVA","korean_name":"카바","english_name":"Kava"},{"market":"BTC-KAVA","korean_name":"카바","english_name":"Kava"},{"market":"KRW-AHT","korean_name":"아하토큰","english_name":"AhaToken"},{"market":"KRW-LINK","korean_name":"체인링크","english_name":"Chainlink"},{"market":"KRW-XTZ","korean_name":"테조스","english_name":"Tezos"},{"market":"KRW-BORA","korean_name":"보라","english_name":"BORA"},{"market":"BTC-JST","korean_name":"저스트","english_name":"JUST"},{"market":"BTC-CHR","korean_name":"크로미아","english_name":"Chromia"},{"market":"BTC-DAD","korean_name":"다드","english_name":"DAD"},{"market":"BTC-TON","korean_name":"톤","english_name":"TON"},{"market":"KRW-JST","korean_name":"저스트","english_name":"JUST"},{"market":"BTC-CTSI","korean_name":"카르테시","english_name":"Cartesi"},{"market":"BTC-DOT","korean_name":"폴카닷","english_name":"Polkadot"},{"market":"KRW-CRO","korean_name":"크립토닷컴체인","english_name":"Crypto.com Chain"},{"market":"BTC-COMP","korean_name":"컴파운드","english_name":"Compound"},{"market":"BTC-SXP","korean_name":"스와이프","english_name":"Swipe"},{"market":"BTC-HUNT","korean_name":"헌트","english_name":"HUNT"},{"market":"KRW-TON","korean_name":"톤","english_name":"TON"},{"market":"BTC-ONIT","korean_name":"온버프","english_name":"ONBUFF"},{"market":"BTC-CRV","korean_name":"커브","english_name":"Curve"},{"market":"BTC-ALGO","korean_name":"알고랜드","english_name":"Algorand"},{"market":"BTC-RSR","korean_name":"리저브라이트","english_name":"Reserve Rights"},{"market":"KRW-SXP","korean_name":"스와이프","english_name":"Swipe"},{"market":"BTC-OXT","korean_name":"오키드","english_name":"Orchid"},{"market":"BTC-PLA","korean_name":"플레이댑","english_name":"PlayDapp"},{"market":"KRW-HUNT","korean_name":"헌트","english_name":"HUNT"},{"market":"BTC-MARO","korean_name":"마로","english_name":"Maro"},{"market":"BTC-SAND","korean_name":"샌드박스","english_name":"The Sandbox"},{"market":"BTC-SUN","korean_name":"썬","english_name":"SUN"},{"market":"KRW-PLA","korean_name":"플레이댑","english_name":"PlayDapp"},{"market":"KRW-DOT","korean_name":"폴카닷","english_name":"Polkadot"},{"market":"BTC-SRM","korean_name":"세럼","english_name":"Serum"},{"market":"BTC-QTCON","korean_name":"퀴즈톡","english_name":"Quiztok"},{"market":"BTC-MVL","korean_name":"엠블","english_name":"MVL"},{"market":"KRW-SRM","korean_name":"세럼","english_name":"Serum"},{"market":"KRW-MVL","korean_name":"엠블","english_name":"MVL"},{"market":"BTC-GXC","korean_name":"지엑스체인","english_name":"GXChain"},{"market":"BTC-AQT","korean_name":"알파쿼크","english_name":"Alpha Quark Token"},{"market":"BTC-AXS","korean_name":"엑시인피니티","english_name":"Axie Infinity"},{"market":"BTC-STRAX","korean_name":"스트라티스","english_name":"Stratis"},{"market":"KRW-STRAX","korean_name":"스트라티스","english_name":"Stratis"},{"market":"KRW-AQT","korean_name":"알파쿼크","english_name":"Alpha Quark Token"},{"market":"BTC-GLM","korean_name":"골렘","english_name":"Golem"},{"market":"KRW-GLM","korean_name":"골렘","english_name":"Golem"},{"market":"BTC-FCT2","korean_name":"피르마체인","english_name":"FirmaChain"},{"market":"BTC-SSX","korean_name":"썸씽","english_name":"SOMESING"},{"market":"KRW-SSX","korean_name":"썸씽","english_name":"SOMESING"},{"market":"KRW-META","korean_name":"메타디움","english_name":"Metadium"},{"market":"KRW-FCT2","korean_name":"피르마체인","english_name":"FirmaChain"},{"market":"BTC-FIL","korean_name":"파일코인","english_name":"Filecoin"},{"market":"BTC-UNI","korean_name":"유니스왑","english_name":"Uniswap"},{"market":"BTC-BASIC","korean_name":"베이직","english_name":"Basic"},{"market":"BTC-INJ","korean_name":"인젝티브프로토콜","english_name":"Injective Protocol"},{"market":"BTC-PROM","korean_name":"프로메테우스","english_name":"Prometeus"},{"market":"BTC-VAL","korean_name":"밸리디티","english_name":"Validity"},{"market":"BTC-PSG","korean_name":"파리생제르맹","english_name":"Paris Saint-Germain Fan Token"},{"market":"BTC-JUV","korean_name":"유벤투스","english_name":"Juventus Fan Token"},{"market":"BTC-CBK","korean_name":"코박토큰","english_name":"Cobak Token"},{"market":"BTC-FOR","korean_name":"포튜브","english_name":"ForTube"},{"market":"KRW-CBK","korean_name":"코박토큰","english_name":"Cobak Token"},{"market":"BTC-BFC","korean_name":"바이프로스트","english_name":"Bifrost"},{"market":"BTC-LINA","korean_name":"리니어파이낸스","english_name":"Linear"},{"market":"BTC-HUM","korean_name":"휴먼스케이프","english_name":"Humanscape"},{"market":"BTC-CELO","korean_name":"셀로","english_name":"Celo"},{"market":"KRW-SAND","korean_name":"샌드박스","english_name":"The Sandbox"},{"market":"KRW-HUM","korean_name":"휴먼스케이프","english_name":"Humanscape"},{"market":"BTC-IQ","korean_name":"에브리피디아","english_name":"Everipedia"},{"market":"BTC-STX","korean_name":"스택스","english_name":"Stacks"},{"market":"KRW-DOGE","korean_name":"도지코인","english_name":"Dogecoin"},{"market":"BTC-NEAR","korean_name":"니어프로토콜","english_name":"NEAR Protocol"},{"market":"BTC-AUCTION","korean_name":"바운스토큰","english_name":"Bounce"},{"market":"BTC-DAWN","korean_name":"던프로토콜","english_name":"Dawn Protocol"},{"market":"BTC-FLOW","korean_name":"플로우","english_name":"Flow"},{"market":"BTC-STRK","korean_name":"스트라이크","english_name":"Strike"},{"market":"KRW-STRK","korean_name":"스트라이크","english_name":"Strike"},{"market":"BTC-PUNDIX","korean_name":"펀디엑스","english_name":"Pundi X"},{"market":"KRW-PUNDIX","korean_name":"펀디엑스","english_name":"Pundi X"},{"market":"KRW-FLOW","korean_name":"플로우","english_name":"Flow"},{"market":"KRW-DAWN","korean_name":"던프로토콜","english_name":"Dawn Protocol"},{"market":"KRW-AXS","korean_name":"엑시인피니티","english_name":"Axie Infinity"},{"market":"KRW-STX","korean_name":"스택스","english_name":"Stacks"},{"market":"BTC-GRT","korean_name":"그래프","english_name":"The Graph"},{"market":"BTC-SNX","korean_name":"신세틱스","english_name":"Synthetix"},{"market":"BTC-USDP","korean_name":"팍스달러","english_name":"Pax Dollar"},{"market":"KRW-XEC","korean_name":"이캐시","english_name":"eCash"},{"market":"KRW-SOL","korean_name":"솔라나","english_name":"Solana"},{"market":"BTC-SOL","korean_name":"솔라나","english_name":"Solana"},{"market":"KRW-MATIC","korean_name":"폴리곤","english_name":"Polygon"},{"market":"BTC-MATIC","korean_name":"폴리곤","english_name":"Polygon"},{"market":"KRW-NU","korean_name":"누사이퍼","english_name":"Nucypher"},{"market":"BTC-NU","korean_name":"누사이퍼","english_name":"Nucypher"},{"market":"KRW-AAVE","korean_name":"에이브","english_name":"Aave"},{"market":"KRW-1INCH","korean_name":"1인치네트워크","english_name":"1inch Network"},{"market":"BTC-AAVE","korean_name":"에이브","english_name":"Aave"},{"market":"BTC-1INCH","korean_name":"1인치네트워크","english_name":"1inch Network"},{"market":"BTC-MASK","korean_name":"마스크네트워크","english_name":"Mask Network"},{"market":"KRW-ALGO","korean_name":"알고랜드","english_name":"Algorand"},{"market":"BTC-AUDIO","korean_name":"오디우스","english_name":"Audius"},{"market":"KRW-NEAR","korean_name":"니어프로토콜","english_name":"NEAR Protocol"},{"market":"BTC-YGG","korean_name":"일드길드게임즈","english_name":"Yield Guild Games"},{"market":"BTC-GTC","korean_name":"깃코인","english_name":"Gitcoin"},{"market":"BTC-OCEAN","korean_name":"오션프로토콜","english_name":"Ocean Protocol"},{"market":"BTC-CTC","korean_name":"크레딧코인","english_name":"Creditcoin"},{"market":"BTC-LPT","korean_name":"라이브피어","english_name":"Livepeer"},{"market":"KRW-WEMIX","korean_name":"위믹스","english_name":"Wemix"},{"market":"BTC-WEMIX","korean_name":"위믹스","english_name":"Wemix"}]
"""
let data = upBitData.data(using: .utf8)
struct UpBitModel: Decodable {
let market: String
let korean_name: String
let english_name: String
}
let models = try! JSONDecoder().decode([UpBitModel].self, from: data!)
var results: [String:String] = [:]
OrderCurrency.allCases // CaseIterable을 채택
.map {
for model in models {
let market = model.market.split(separator: "-").map { String($0) }[1] // 하이픈 뒤의 요소만 남김
if $0.rawValue == market {
results[$0.rawValue] = model.korean_name
break
} else {
results[$0.rawValue] = "없음"
}
}
}
// results에 결과물 반영
결과물은 빗썸의 order concurrency를 키로, 한글 이름을 value로 하는 딕셔너리가 돼요. 그리고 아래 메서드를 통해 몇 개나 매칭 되는지 확인했어요.
print(results.values.filter { $0 == "없음" }.count) // 88개
무려 88개의 코인 종류에 한글 이름을 하드코딩으로 입력해주어야 해요..
이런 식의 코딩은 너무나 비효율이라고 판단해서 빗썸의 서버 팀에 한글 이름을 보다 효율적으로 받을 수 있는 방법에 대해 문의해놓은 상태예요.
늦은 답변으로 결국 직접 입력하는 것으로 결정했어요.
API 문서 어디에서도 한글 이름을 제공하는 곳이 없더라고요.. 🥲
'iOS 앱개발 > 암호화폐 거래소 앱 프로젝트' 카테고리의 다른 글
[암호화폐 거래소 앱 만들기] - 소켓 통신을 통해 코인 정보를 업데이트 하기 (0) | 2022.02.05 |
---|---|
[암호화폐 거래소 앱 만들기] - TableView에서 Cell을 클릭할 경우 다른 화면으로 넘어가기 (0) | 2022.01.30 |
[암호화폐 거래소 앱 만들기] - SearchBar에 검색어를 입력해 검색 결과를 출력해주는 기능을 구현 (0) | 2022.01.26 |
[암호화폐 거래소 앱 만들기] 받아온 데이터에서 원하지 않는 값 제거하기 (0) | 2022.01.26 |
[암호화폐 거래소 앱 만들기] 프로젝트 시작 및 첫 화면 설계하기 (0) | 2022.01.25 |
- Total
- Today
- Yesterday
- django#slicing
- 공유기 설치#BOJ#이분탐색#Python
- 암호코드#dp#BOJ#Python
- 터틀비치#리콘#xbox#controller
- NumberofDiscIntersections#Codility#Sort#Python
- 랜선자르기#이분탐색#BOJ#Python
- Swift#Tuples#Range
- 병든 나이트#BOJ#탐욕법#Python
- django
- PassingCars#Codility#Python
- 파이썬알고리즘인터뷰#4장
- API#lazy#
- Brackets#Stacks and Queues#Codility#Python
- N으로 표현#DP#Programmers#Python
- 배열합치기#분할정복#BOJ#Python
- 텀 프로젝트#백준알고리즘#Python
- Distinct#Codility#Python
- 순열사이클#BOJ#Python
- 리모컨#완전탐색#BOJ#Python
- 반복수열#백준알고리즘#Python
- filter#isalnum#lower
- 백준 알고리즘#BackTracking
- 날짜 계산#BOJ#완전탐색#Python
- 쿼드트리#BOJ#분할정복#Python
- 섬의개수#백준알고리즘#Python
- Triangle#Sorting#Codility#Python
- 미로 탐색#백준알고리즘#Python
- 토마토#백준알고리즘#Python
- 나무자르기#BOJ#이분탐색#Python
- 종이자르기#분할정복#BOJ#Python
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |