lasconic / finary_uapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import/update real estate data?

nmathey opened this issue · comments

commented

Hi,

Thinking about making a POC for integrating RealT data into Finary.
Do you think it is feasible via your work and your knowledge of Finary API?

I'm not a RealT customer so I'm not really sure what sort of data from RealT you would want to add to Finary.
You want to add Tokens in the crypto part ? Or you have enough information to enter a real estate object and then you have a fraction of it ? (not sure if Finary support <1% ownership)
Tell me more and I might be able to help.

commented

I'd like to actually register RealT Token as a real estate object as a fraction of it.
I did a quick try via the web app: while creating some mandatory value can't be set to <1%, ownership included yes, but it can be done afterward on modification.

FYI, here is a complete token object extract via RealT API: we have basically more than enough and may need to adjust some value like currency, area sqft, etc.

{'fullName': '10410 Cadieux Rd, Detroit, MI 48224', 'shortName': '10410 Cadieux', 'symbol': 'REALTOKEN-S-10410-CADIEUX-RD-DETROIT-MI', 'productType': 'real_estate_rental', 'tokenPrice': 50.91, 'canal': 'release', 'currency': 'USD', 'totalTokens': 32500, 'totalTokensRegSummed': 32500, 'uuid': '0x4637aa1a13aa4050c6e4bcd6dde9c39e80e9dd54', 'ethereumContract': '0x4637aa1a13aa4050c6e4bcd6dde9c39e80e9dd54', 'xDaiContract': '0x4637aa1a13aa4050c6e4bcd6dde9c39e80e9dd54', 'gnosisContract': '0x4637aa1a13aa4050c6e4bcd6dde9c39e80e9dd54', 'goerliContract': None, 'totalInvestment': 1654575, 'grossRentYear': 315600, 'grossRentMonth': 26300, 'propertyManagement': 2104, 'propertyManagementPercent': 0.08, 'realtPlatform': 526, 'realtPlatformPercent': 0.02, 'insurance': 690, 'propertyTaxes': 2230, 'utilities': 5240, 'initialMaintenanceReserve': 52600, 'netRentDay': 444.16438356164, 'netRentMonth': 13510, 'netRentYear': 162120, 'netRentDayPerToken': 0.013666596417281, 'netRentMonthPerToken': 0.41569230769231, 'netRentYearPerToken': 4.9883076923077, 'annualPercentageYield': 9.7982865690585, 'coordinate': {'lat': '42.420852', 'lng': '-82.938980'}, 'marketplaceLink': 'https://realt.co/product/10410-cadieux-rd-detroit-mi-48224/', 'imageLink': ['https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-hero-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-map-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-aerial-6.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-aerial-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-aerial-5.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-aerial-4.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-aerial-2.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-aerial-3.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-front-4.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-front-1a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-front-2b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-front-2a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-front-1b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-side-1a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-side-1b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-exterior-2a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-exterior-1a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-exterior-1b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-exterior-stairs-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-1a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-1b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-kitchen-1a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-kitchen-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-kitchen-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-bath-1a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-bath-1b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-bed-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-2a.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-2b.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-living-3.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-bath-3.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-bath-2.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-basement-1.jpg', 'https://realt.co/wp-content/uploads/2023/05/10410-Cadieux-basement-2.jpg'], 'propertyType': 2, 'squareFeet': 20416, 'lotSize': 37260, 'bedroomBath': '35x1 Bed / 35x1 Bath', 'hasTenants': True, 'rentedUnits': 35, 'totalUnits': 35, 'termOfLease': None, 'renewalDate': None, 'section8paid': 0, 'subsidyStatus': 'no', 'subsidyStatusValue': None, 'subsidyBy': None, 'sellPropertyTo': 'intl_investors_only', 'secondaryMarketplace': {'UniswapV1': 0, 'UniswapV2': 0}, 'secondaryMarketplaces': [{'chainId': 100, 'chainName': 'xDaiChain', 'dexName': 'LevinSwap', 'contractPool': '0x4852f9eebdde495d0f02d158d1025c4b5d78742e', 'pair': {'contract': '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83', 'symbol': 'USDC', 'name': 'USD//C on xDai'}}], 'blockchainAddresses': {'ethereum': {'chainName': 'Ethereum', 'chainId': 1, 'contract': '0x4637aa1a13aa4050c6e4bcd6dde9c39e80e9dd54', 'distributor': '0x6e71DE54b6e289703AF8FBa4749231334e00A9Af', 'maintenance': '0x2944c261Fe6bFbED7e432fcf66a860af7aF7033a'}, 'xDai': {'chainName': 'xDaiChain', 'chainId': 100, 'contract': '0x4637aa1a13aa4050c6e4bcd6dde9c39e80e9dd54', 'distributor': '0x6e71DE54b6e289703AF8FBa4749231334e00A9Af', 'rmmPoolAddress': 0, 'chainlinkPriceContract': '0x6d7AB5914ECBd10D51d0c8a8Ae863843C55a25b7'}, 'goerli': {'chainName': 'Goerli testnet', 'chainId': 5, 'contract': 0, 'distributor': 0, 'rmmPoolAddress': 0, 'chainlinkPriceContract': 0}}, 'underlyingAssetPrice': 1360000, 'renovationReserve': 75000, 'propertyMaintenanceMonthly': 2000, 'rentStartDate': {'date': '2023-07-01 00:00:00.000000', 'timezone_type': 3, 'timezone': 'UTC'}, 'lastUpdate': {'date': '2023-10-08 19:24:32.000000', 'timezone_type': 3, 'timezone': 'UTC'}, 'originSecondaryMarketplaces': [{'chainId': 100, 'chainName': 'xDaiChain', 'dexName': 'LevinSwap', 'contractPool': '0x4852f9eebdde495d0f02d158d1025c4b5d78742e'}], 'initialLaunchDate': {'date': '2023-05-18 00:00:00.000000', 'timezone_type': 3, 'timezone': 'UTC'}, 'seriesNumber': 320, 'constructionYear': 1955, 'constructionType': 'Brick', 'roofType': 'Asphalt', 'assetParking': None, 'foundation': 'Slab', 'heating': 'Forced Air', 'cooling': 'None', 'tokenIdRules': 100349, 'rentCalculationType': 'constant', 'realtListingFeePercent': 0.1, 'realtListingFee': 165455.56, 'miscellaneousCosts': None, 'propertyStories': 2, 'rentalType': 'long_term'}

Then yes, it should be possible. I didn't write the POST call here : https://github.com/lasconic/finary_uapi/blob/main/finary_uapi/user_real_estates.py but I believe a real estate object is created with a single large POST.

Also in my experience, the <1% check is done by the UI, but not enforced by the server, so a single call should do it.
You can see the POST to /users/me/real_estates if you create a test object in the UI and check your browser dev tools network tab.

commented

I wasn't able to find anything POST to /users/me/real_estates. However I have something POST to /organizations/<UIID>/users/<my-email>/real_estates

Maybe because I'm using the family member feature?

{
"is_automated_valuation":false,
"is_furnished":false,
"is_new":false,
"has_lift":false,
"has_sauna":false,
"has_pool":false,
"flooring_quality":null,
"flooring_condition":null,
"windows_quality":null,
"windows_condition":null,
"bathrooms_quality":null,"
bathrooms_condition":null,
"kitchen_quality":null,
"kitchen_condition":null,
"general_quality":null,
"general_condition":null,
"parking_spaces":null,
"garage_spaces":null,
"number_of_rooms":null,
"number_of_bathrooms":null,
"number_of_floors":null,
"floor_number":null,
"balcony_area":null,
"garden_area":null,
"category":"rent",
"monthly_charges":12000,
"monthly_rent":26000,
"yearly_taxes":22000,
"rental_period":"annual",
"rental_type":"nue",
"is_estimable":false,
"user_estimated_value":1600001,
"description":"RealT - 10410 Cadieux Rd, Detroit, MI 48224",
"surface":3000,
"agency_fees":null,
"notary_fees":null,
"furnishing_fees":null,
"renovation_fees":null,
"buying_price":1600000,
"building_type":"building",
"ownership_percentage":1,
"place_id":"ChIJ7bJzDHDWJIgRCht-FnDVfn8"
}

The call should work the same for users/me/real_estates and you don't need the org and the mail.

commented

I confirm the call works on users/me/real_estates
I'm now block on place_id Finary attribute which seems generated from an internal database based from the full address entered at the very beginning in the UI :/
Since this is a mandatory step/attribute I'm not sure how to deal with it: even more not all addresses are found on the Finary side (for exemple my own place can't be find :))

It doesn't have to be the exact place I believe, the street name or a street close by should work, and you can get a placeId. I missed it when I checked the call... I was hoping that we could do it with a single call.

commented

Ok will try to catch this id and then see if all attributes are needed to simplify the POST as much as possible for now

commented

We can get places ID from the Finary DB with a GET to https://api.finary.com/real_estates/autocomplete?query=<address>

EDIT: Just found out they seem to use Google Map data somehow as my own street is also wrong in GMap which may explain why I can't find it on Finary :)

EDIT2: Confirmed the place_id is from Google Map API

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?
fields=formatted_address%2Cgeometry%2Cplace_id <-- what we want to return
&input=%2210410%20CADIEUX%20RD,%20DETROIT,%20MI%2048224%22&inputtype=textquery <-- search query
&locationbias=circle%3A10%4042.420852%20-82.938980 <-- we can specify coordinate area for search, optional but good for holdings without strict address number and/or limit the result to 1 place only
&key=<Google API Key>

Result

{
    "candidates": [
        {
            "formatted_address": "10410 Cadieux Rd, Detroit, MI 48224, USA",
            "geometry": {
                "location": {
                    "lat": 42.4208516,
                    "lng": -82.93898
                },
                "viewport": {
                    "northeast": {
                        "lat": 42.42228877989272,
                        "lng": -82.9375588701073
                    },
                    "southwest": {
                        "lat": 42.41958912010728,
                        "lng": -82.94025852989273
                    }
                }
            },
            "place_id": "ChIJ7bJzDHDWJIgRCht-FnDVfn8"
        }
    ],
    "status": "OK"
}

Nice find!

Feel free to make a PR if you want to the POST and the autocomplete in this package

commented

yep working on it.
However I will need you to review my code as I'm not a dev so some pieces might need correction :)

finary_uapi-0.1.8 should hit Pypi soon and contains your code.